Re: Fetching XML for parsing
| From: | Patagonia Hosting Development Group | Date: | Sat, 24 Apr 2004 17:09:17 +0000 |
| Subject: | Re: Fetching XML for parsing | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184528@lists.php.net to get a copy of this message | ||
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?
Thanks a lot,
Cesar Aracena
Patagonia Hosting Development Group
"Mike Ryerse" <mikeryerse@yahoo.com> escribió en el mensaje
news:20040423214324.67797.qmail@web13602.mail.yahoo.com...
> How is your fopen code written?
> Could it have something to do with your browser is requesting a
> dynamically built page, and your php script is not?
>
> --- Patagonia Hosting Development Group
> <development@patagoniahosting.net> wrote:
> > Hi all,
> >
> > I know that fopen and fread should do the trick, but for some
> > strange reason
> > (maybe piping) I get an error when trying to fetch a XML document
> > generated
> > from an ASP page. If I open the file in my browser, I click in
> > "View Source
> > Code", copy and paste it in a new notepad document, save it as a
> > .xml file
> > and then open it, my sript works fine. The problem is when fetching
> > the
> > "live" version. It tells me the error is some misspelled tag at
> > line 8.
> >
> > Has anybody seen this before?
> >
> > Thanks in advanced,
> >
> > Cesar Aracena
> > Patagonia Hosting Development Group
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25¢
> http://photos.yahoo.com/ph/print_splash