I got it to work with the following code. Thank you so much for your help. The problem is now back to the beginning, I can not get the $Line value, which is the data I want to be pushed into an array. I did not get an error with the code below, but I did not get any information when printing the array.
<?php //$Symbols[] = 'ek'; //$Symbols[] = 'et'; $Symbols[] = 'IKN'; $StockStuff = array(); $URI = 'http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol='; function StartHandler($Parser, $ElementName, $Attr='') { print "<b>$ElementName:</b> "; } function CharacterHandler($Parser, $Line) { array_push($StockStuff, $Line); print "$Line<br>\n"; } function EndHandler($Parser, $ElementName, $Attr='') { } while ( list(,$Sym) = each($Symbols) ) { $Contents = implode( '', file("$URI$Sym") ); $Parser = xml_parser_create('ISO-8859-1'); xml_set_element_handler($Parser, 'StartHandler', 'EndHandler'); xml_set_character_data_handler($Parser, 'CharacterHandler'); if ( xml_parse($Parser, $Contents) ) { echo 'YES!<br>'; } else { echo 'NO!<br>'; } xml_parser_free($Parser); } print "1st Position in the array = $StockStuff[0]<br>\n"; ?> -----Original Message----- From: Christopher J. Crane [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 7:21 AM To: Crane, Christopher Subject: Fw: [PHP] XML HELP ----- Original Message ----- From: "Analysis & Solutions" <[EMAIL PROTECTED]> Newsgroups: php.general To: "PHP List" <[EMAIL PROTECTED]> Sent: Monday, April 08, 2002 10:33 PM Subject: Re: [PHP] XML HELP > Hey Christopher: > > On Mon, Apr 08, 2002 at 09:14:08PM -0400, Christopher J. Crane wrote: > > ok I tried this at your suggestion.... > > Not exactly. As mentioned, you've got all sorts of unneded stuff going > on. To make sure you're on the right track, start with a new script > with just the basics: > > > <?php > > $Symbols[] = 'ek'; > $Symbols[] = 'et'; > > $URI = 'http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol='; > > > function StartHandler($Parser, $ElementName, $Attr='') { > } > > function CharacterHandler($Parser, $Line) { > } > > function EndHandler($Parser, $ElementName, $Attr='') { > } > > > while ( list(,$Sym) = each($Symbols) ) { > $Contents = implode( '', file("$URI$Sym") ); > > $Parser = xml_parser_create('ISO-8859-1'); > xml_set_element_handler($Parser, 'StartHandler', 'EndHandler'); > xml_set_character_data_handler($Parser, 'CharacterHandler'); > > if ( xml_parse($Parser, $Contents) ) { > echo 'YES!'; > } else { > echo 'NO!'; > } > > xml_parser_free($Parser); > > } > > ?> > > > Now, if that works, start flushing out the element/character handlers. > Do it little by little to make sure each of your steps are correct. > > Enjoy, > > --Dan > > -- > PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php