ok I tried this code and the array is still empty.
By the way, my code looked the way it did because the browser or my mail
client cut it off. I had each of the functions on one line for easy reading
but because of the wrap I changed it to how you had it, which is how I would
normally do it if each function had more than one line to it.
 
<?php
 
//$Symbols[] = 'ek';
//$Symbols[] = 'et';
$Symbols[] = 'IKN';
 
$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, $StockStuff) {
 array_push($StockStuff, $Line);
 print "$Line<br>\n";
 }
 
function EndHandler($Parser, $ElementName, $Attr='') {
 }
 
 
while ( list(,$Sym) = each($Symbols) ) {
 global $StockStuff;
 $StockStuff = array();
    
 $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[1]<br>\n";
  }
 
?>

Christopher J. Crane
Network Operations Manager

IKON Office Solutions
860.659.6464

 

Reply via email to