hi
a wired thing that the demo is working but the default generated php cpde is not working for this url
{link saved}
<?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["GUID"];
print $record["TITLE"];
print $record["LINK"];
print $record["PUBDATE"];
print $record["DESCRIPTION"];
}
MagicParser_parse("http://www.example.com/news_rss.php","myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>
any ideas ?
Hi,
As with the previous RSS that you were not able to fetch, the example code is working fine on my test service. I see from the source code that you posted regarding the maximum number of calls to MagicParser_parse() that you are setting the user agent so that should not be the problem.
What I would suggest therefore is trying the CURL equivalent, which would be:
<?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["GUID"];
print $record["TITLE"];
print $record["LINK"];
print $record["PUBDATE"];
print $record["DESCRIPTION"];
}
$url = "http://www.example.com/news_rss.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec($ch);
curl_close($ch);
MagicParser_parse("string://".$xml,"myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>
(don't forget to change www.example.com to the host / domain name of your feed)
Hope this helps!
Cheers,
David
--
MagicParser.com