You are here:  » help needed


help needed

Submitted by nans on Wed, 2006-03-15 21:58 in

Just bought and downloaded MagicParser..;
Wanted to test this feed:
http://www.zoomin.tv/xml/?pid=gazet&language=vla&cat=binnenland

But your script gives this:
could not open http://www.zoomin.tv/xml/?pid=gazet&language=vla&cat=binnenland

What's wrong?

Nans

Submitted by support on Wed, 2006-03-15 22:03

Hi Nans,

This is almost certainly because URL Wrappers are not enabled on your PHP installation. The following page provides more information:

http://uk.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen

If you have full administration access to your server you can enable URL wrappers through php.ini. If you have a shared hosting account you will need to contact your hosting provider and ask them to enable URL wrappers for your account if you wish to parse a file from a URL.

The primary alternative is downloading the file manually (use your web browser) and then save the file to disk and upload to your web server via FTP as normal.

Hope this helps - a number of users have had success asking their host to enable URL wrappers for them.

Cheers,
David.

Submitted by nans on Thu, 2006-03-16 12:37

Ok! That's fixed, I can load the feed.
But, since I'm completly a newbie to xml, I'm having problems to display the data.

This is the page:
http://www.femistyle.be/MagicParser/zoomtest.php
(only display my own titel)

This is the code:

<?php
  
require("MagicParser.php");
  function 
myRecordHandler($programme)
  {
    print 
"<h2><a href='".$programme["VIDEOURL"]."'>".$programme["TITLE"]."</a></h2>";
    print 
"<a align=left href='".$programme["VIDEOURL"]."'>".$programme["IMAGEURL"]."</a>";
    print 
"<p>".$programme["DESCRIPTION"]."</p>";
  }
  print 
"<h1>Videonieuws ZOOM</h1>";
  
$url "http://www.zoomin.tv/xml/?pid=gazet&language=vla&cat=binnenland";    
  
MagicParser_parse($url,"myRecordHandler","xml|VIDEOLISTING/PROGRAMME/");  
  if (!
$result)
  {
    print 
MagicParser_getErrorMessage();
  }
?>

What do you suggest?

Nans

Submitted by support on Thu, 2006-03-16 12:41

Hello Nans,

Your Magic Parser "Format String" for that XML document is not quite right. You are using:

xml|VIDEOLISTING/PROGRAMME/

Having looked at the XML, I think it should be:

xml|FTVVIDEOLIST/VIDEOLISTING/PROGRAMME/

If you just change that over in the code it should work fine! Here is the code being displayed in the demo script; you can see the above format string if you click "View Source"...

http://www.magicparser.com/demo?fileID=44195CE9C4696&record=1 (will be deleted shortly!)

Hope this helps!
David.

Submitted by nans on Thu, 2006-03-16 13:08

Hi David,

Okay, next problem I have now

In the feed I have following:

avascript:ftvlaunch(207765,3,'gazet');

the word 'gazet' is causing an error because of the '

How can I fix this? The feed cannot be changed (is same feed for several portals)

Tested with Firefox: http://www.femistyle.be/MagicParser/zoomtest.php

N

Submitted by support on Thu, 2006-03-16 13:14

If the URL you have to work with contains apostrophes, you can use quotes instead - but they will need to be escaped with the backslash character like this:

    print "<h2><a href=\"".$programme["VIDEOURL"]."\">".$programme["TITLE"]."</a></h2>";
    print "<a align=left href=\"".$programme["VIDEOURL"]."\">".$programme["IMAGEURL"]."</a>";
    print "<p>".$programme["DESCRIPTION"]."</p>";

I also notice that you are displaying an Image URL. If you want to display the actual image you need to use that within an img tag, like this:

    print "<a align=left href=\"".$programme["VIDEOURL"]."\"><img border=\"0\" src=\"".$programme["IMAGEURL"]."\"></a>";

I think there's another problem you may have working with that feed. The links contain JavaScript; so your page must have access to the JavaScript function that they are calling. This means you have to have a links to the script somewhere else on your page - check with the tech info regarding the feed for more info on this.

Cheers,
David.

Submitted by nans on Thu, 2006-03-16 14:43

It works now!! Big thanks!
(The javascript call is in the head tag of the page)

Nans