Re: Fetching XML for parsing
| From: | Pablo | Date: | Thu, 29 Apr 2004 15:15:01 +0000 |
| Subject: | Re: Fetching XML for parsing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184951@lists.php.net to get a copy of this message | ||
On 04/27/2004 2:53 PM, Patagonia Hosting Development Group
<development@patagoniahosting.net> wrote:
> Does anybody has something on this? :)
>
> Thanks.
>
> "Patagonia Hosting Development Group" <development@patagoniahosting.net>
> escribió en el mensaje
> news:20040424170911.76101.qmail@pb1.pair.com...
>> That may be the exact problem. I was not figuring that one out. Thi is my
>> fopen and XML parser code:
>>
>> $xml_parser = xml_parser_create();
>> xml_set_element_handler($xml_parser, "startElement", "endElement");
>> xml_set_character_data_handler($xml_parser, "characterData");
>> if (!($fp = fopen($uFile,"rb"))) {
>> die ("could not open RSS for 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);
>>
>> How can I make PHP to first open the dynamically built page and THEN read
>> it's content?
Do you have allow_url_fopen=On in php.ini? Given that your code works with a
local copy of the .xml file but not the 'live' version, this could be an
explanation.
Pablo