PEAR XML RSS problem

This is a discussion on PEAR XML RSS problem within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi guys I hope someone can help, Using http://www.stargeek.com/php_scripts.php?script=1 as a basis and ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-07-2004
Chris Arthur
 
Posts: n/a
Default PEAR XML RSS problem

Hi guys

I hope someone can help, Using
http://www.stargeek.com/php_scripts.php?script=1
as a basis and using the PEAR XML_RSS parser
http://pear.php.net/package-info.php?pacid=22
I've hacked together a PHP script which pulls feed addresses from a
database then dumps new feed items into my mysql database - all was
going well with feeds such as
lineages.co.uk/wp-rss2.php
working fine but i've found a number of feeds that just get skipped over
rather than inserting ....
some of the feeds causing
problems....http://www.voidstar.com/gnews2rss.ph...15&q=genealogy
http://genealogyresources.blogspot.c...yresources.xml
http://news.genealogytoday.com/index.xml

At first I thought the cause was the difference in files decalring
themselves RDF rather than RSS but thats not the case - then I thought
it was the parser choking on & but the genealgytoday feed doesn't have
an & in it

The bit of the script that does the parsing and insert to the database....

foreach ($feeds as $f)
{
echo $f['address']."\n";
$this = split('/', $f['address']);
$fp = fsockopen ($this[2], 80, $errno, $errstr, 8);
if ($fp)
{
echo "connected to feed...";
//use php library's, pear's, XML_RSS class as the parser
$r = &new XML_RSS($f['address']);
$r->parse();
echo "....feed parsed now getting items....";
foreach ($r->getItems() as $value)
{
echo "I am inside the foreach but have I got any damn items....";
$value['title']= trim($value['title']);
echo $value['title']."\n...title of feed....";
$value['link']= trim($value['link']);
if ( (!in_array(trim($value['title']), $titles)) and
(!(in_array($value['link'], $links))) and ($value['title']))
{
$titles[] = $value['title'];
echo $value['title']."\n";
$links[] = $value['link'];
list($link, $extension) = explode(".", $value['link']);
$title = $value['title']." ".$value['description'];
$title = $value['title'];
$link = $value['link'];
$desc = $value['description'];
$date = $nowtime;
$site = $f['site'];

$querya = ("insert into genealogy_posts ( post_author,post_date ,
post_date_gmt, post_content, post_title, post_category, post_excerpt,
post_modified, post_modified_gmt, link) values ( '1',NOW(),
DATE_SUB(NOW(), INTERVAL 1
HOUR),'".mysql_escape_string($desc)."','".mysql_es cape_string($title)."',
'0', '".mysql_escape_string($desc)."', NOW() ,DATE_SUB(NOW(), INTERVAL 1
HOUR), '".mysql_escape_string($link)."')");

flush();
mysql_query($querya);

}
else {
echo "....nothing new here....";}
}
}
else
{
echo "unresponsive\n";
}
}

For those that fail I DONT get "I am inside the foreach but have I got
any damn items...." message

It has been suggested I need to escape the items (eg by addslashes() )
which I assumed to be cData in the PEAR RSS.php - but from what I gather
the script doesn't get far enough?

Any help is gratefully appreciated as I really don't have a clue ;-)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:11 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0