Hey All,
I'm just getting started with magicparser, cause I just have to learn how to use feeds and i've been told Magicparser and it's team are the best when it comes to feeds.
Currently I'm trying to get a productfeed to work, but when I go to the page, i just get a blank screen. Here's what I have:
MagicParserTest.php:
<?php
require("MagicParser.php");
function myRecordHandler($record)
{
print_r($record);
}
MagicParser_parse("{link saved}","myRecordHandler");
?>
Thanks in advanced for the help i'm hoping for :)
David,
Ihave a new feed URL that just gives a blank result as well. The code given online by your site was:
<?php
require("MagicParser.php");
function myRecordHandler($record)
{
// This is where you write your code to process each record, such as loading a database
// You can display the record contents using PHP's internal print_r() function:
print_r($record);
// The following code will print out each field in your sample data:
print $record["ITEM"];
print $record["TITLE"];
print $record["DESCRIPTION"];
print $record["LINK"];
}
MagicParser_parse("http://www.partner-survey.com/td-tools/uk/make_code_promo.php?affId=1235317&type=rss","myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>
Hi,
The issue in the original post was regarding URL wrappers, and PHP not being
configured to be allowed to open files by URL. To see if this is the case,
add the following code at the end of the script (immediately after the call
to MagicParser_parse()....)
print MagicParser_getErrorMessage();
If that turns out to be the case, you would probably need to contact your host
in order to request that URL fopen be enabled for your account - full details
are on the following page:
http://uk2.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
Don't forget of course that for testing purposes, you can simply browse to the
URL with a web browser, and then save the file to disk (use View > Source >
Save As...) and then upload the output (e.g. rss.xml) to your server and
work on the local file instead...
Cheers,
David.
David,
The error message is 'could not open http://www.partner-survey.com/td-tools/uk/make_code_promo.php?affId=1235317&type=rss'.
Kind regards,
Stephen
Hi Stephen,
That does imply that url wrappers are not enabled on your server (see the PHP URL above for more info)... but I noticed in your other query that you may be able to open other URLs without any problems? Is that the case...?
Once thing to try is the BBC News Headlines example in:
http://www.magicparser.com/node/26
...and see if that works...
Cheers,
David.
Hi Klaas,
The code actually looks fine, but it's always best to use a specified format string with large feeds as otherwise the entire file must be read twice by the parser.
I've written a specific test script for this feed which I will email to you now...
Cheers,
David.