You are not logged in.
Hi,
I try to read the RSS feed of simplemachines forum (only for test), but it doesn't work.
In my localhost, I have create a php page with this code (file rss.php):
<?php
$feed = "http://www.simplemachines.org/community/index.php?action=.xml;type=rss2";
//Loop through the array, reading the feeds one by one
readFeeds($feed);
function startElement($xp,$name,$attributes) {
echo "Start $name
";
}
function endElement($xp,$name) {
echo "End: $name
";
}
function characterDataHandler($xp,$data) {
echo "Data: $data
";
}
function readFeeds($feed) {
$fh = fopen($feed,'r');
// open file for reading
$xp = xml_parser_create();
// Create an XML parser resource
xml_set_element_handler($xp, "startElement", "endElement");
// defines which functions to call when element started/ended
xml_set_character_data_handler($xp, "characterDataHandler");
while ($data = fread($fh, 4096)) {
if (!xml_parse($xp,$data)) {
return 'Error in the feed';
}
}
}
?>
It doesn't work.
Next, I have upload my rss.php file in my site and it work:
http://mono.ilbello.com/rss.php
Why fopen in rss.php file doens't work in localhost?
Thanks.
Last edited by monotiz (2008-04-20 16:52:34)
Offline
http://uk2.php.net/fopen
maybe there are some restrictions,,, safe_mode, open_basedir, allow_url_fopen ...
Offline
http://uk2.php.net/fopen
maybe there are some restrictions,,, safe_mode, open_basedir, allow_url_fopen ...
This is the row of my phpinfo.php:
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
...
allow_url_fopen On On
allow_url_include On On
...
open_basedir no value no value
still not work...
Offline
turn error reporting on,
it shoudl hopefully print somethign useful
Offline
turn error reporting on,
it shoudl hopefully print somethign useful
Ok, now work!
Thanks.
Offline