|
Index | Recent Threads | Register | |
![]() |
Forums » List all forums » Forum: Calendar Sharing/Security » Thread: parsing xml feed with php in safari or firefox |
Total posts in this thread: 6 |
[Change thread status]
[Delete this Thread]
[Move this Thread] [Add To My Favorites] [Watch this Thread] [Post new Thread] |
Author |
|
janaballard
New Member
|
hi, i'm trying to parse the xml feed for one of my client's localendars - i can view the xml via safari and firefox but when i try to open the xml via php's fopen function i am unable to open the file. is there something special that i must do to be able to open the xml file remotely? any help here would be greatly appreciated. jana ps i know my php code works because i can open practically any other url with the fopen function call EXCEPT localendar.com. |
||
|
janaballard
New Member
|
i think this has something to do with the tomcat server... i just found this article but it doesn't provide a work-around - http://bugs.php.net/bug.php?id=7373&edit=1 |
||
|
janaballard
New Member
|
Is anyone at localcalendar familiar with the tomcat bug? Can anyone help me with this? |
||
|
support
localendar Expert ![]() Joined: Aug 9, 2022 Posts: 6437 Status: Offline |
I can't find a similar issue on Apache's site; and that bug report is from 5 years ago. I've had to massage enough HTML and XML over the years to know depending on a particular space is a tenuous decision at best. I think the original poster misinterprets the HTTP spec:
since there is no element after the status code (200), there is no requirement for the trailing space, so I would argue PHP is incorrent in this instance. Anyway, what matters is that the site doesn't work for your needs. You can certainly submit it as a bug to Apache, but I would also look to see if there are PHP alternatives to fopen. ---------------------------------------- Marc Higgins Support Associate, localendar.com Follow us on Twitter! http://www.twitter.com/localendar_news |
||||
|
janaballard
New Member
|
This is the exact error I'm getting: Warning: fopen(http://www.localendar.com/public/BFNEP?style=M3) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /Library/WebServer/Documents/Projects/cultivating-youth/testing/xml_parser.php on line 29 Any other url I give the fopen function works - and since this is a SERVER error (and it's localendar's url not a file on my local machine), I am really thinking this is a problem on localendar's end... perhaps some port or permissions need to be changed on the file so that it can be accessed differently - (I'm no browser whiz but maybe this has to do with user-agents and authentication or something...) For reference, here is my code: <pre> <? error_reporting(E_ALL ^ E_NOTICE); ini_set("display_errors", true); //phpinfo(); $file = "http://www.localendar.com/public/BFNEP?style=M3"; $depth = array(); function startElement($parser, $name, $attrs) { global $depth; for ($i = 0; $i < $depth[$parser]; $i++) { echo " "; } echo "$name\n<BR>"; $depth[$parser]++; } function endElement($parser, $name) { global $depth; $depth[$parser]--; } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); if (!($fp = fopen($file, "r"))) { die("could not open XML input"); } while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } xml_parser_free($xml_parser); ?> </pre> I will post this issue to a PHP specific forum as well to see if it's a PHP thing. Thanks again for your help. |
||
|
support
localendar Expert ![]() Joined: Aug 9, 2022 Posts: 6437 Status: Offline |
Thanks for your work on this. Please let me know what direction this takes and any assitance we can provide. ---------------------------------------- Marc Higgins Support Associate, localendar.com Follow us on Twitter! http://www.twitter.com/localendar_news |
||
|
[Show Thread Printable Version] [Post new Thread] |
Help! | Cobranding | Legal | Privacy Policy | About localendar.com | Contact Us |