Hi, I'm trying to write an rss aggregator for strawbale building stories.
Everything works perfectly on my local machine but once on the host server problems start.
They are running php 4.2.2 with safemode on.
Here's the part with the problem in...
while ($row = mysql_fetch_assoc($feedsResult))
{
echo "<dl class=\"feed\"><h1>".$row["site"]."</h1>";
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
echo "TRAPPED!<br/>";
//echo $row['address'];
$fp = fsockopen ($row['address'], 80, $errno, $errstr, 30);
//$fp = fopen($row['address'],"rb");
if (!$fp) {
echo "errstr: $errstr errno:$errno<br>\n";
}
echo "TRAPPED2!";
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
echo "</dl>";
}
the response I get is:
TRAPPED!
errstr: errno:0
TRAPPED2!
Warning: fread(): supplied argument is not a valid File-Handle resource in /customers/lithgow-schmidt.dk/lithgow-schmidt.dk/httpd.www/sb-aggregator/aggregator.phpon line 43
So, we can see that it goes through the fsockopen() without producing an error.
I've checked $row['address'] for whitespace but it's fine, and it open fine in my browser. What then is the problem?
I've searched endlessly though the site and can't find anything that works. I'd love to get this damn thing working!
thanks,
duncan