I'm in a bind right now. I've been using a certain company to obtain stock quote information for my companies website for the past serveral years. Apparently this company merged recently. the new support connect emailed me an XML feed for me to use to incorporate my quote on my page. the funny thing is, the person how emailed me the feed link has no idea what to do with it.

I'm looking for a way to parse the XML feed, which has an XSL extension, with PHP and display the quote on the page.

When I view the link that I was sent, it is blank. When I view the source I see the following:

<RECORDS>
<RECORD SRC="ILXPT" INST="MYL"><FLD F="VOLUME" V="504000"></FLD>
<FLD F="LAST" V="33.84"></FLD>
<FLD F="LAST_TR_MINUTE" V="32"></FLD>
<FLD F="LAST_TR_HOUR" V="13"></FLD>
<FLD F="PRIMARY_MKT_NAME" V="NYSE"></FLD>
<FLD F="CHANGE" V="0.11"></FLD>
<FLD F="LOW" V="33.75"></FLD>
<FLD F="SYMBOL" V="ABC"></FLD>
<FLD F="HIGH" V="34.15"></FLD>
<FLD F="OPEN" V="34"></FLD>
<FLD F="PER_CHANGE" V="0.33"></FLD>
<FLD F="ANNHIGH" V="38.12"></FLD>
<FLD F="CLOSE" V="33.73"></FLD>
<FLD F="ANNLOW" V="25.1"></FLD>
<PressWebServiceDiagnostics V="Press Machine: HORN, Press Sources: ILXPT:FRECKLES(10.10.10.11);REX(10.10.10.10)"></PressWebServiceDiagnostics>
<IsError V="False"></IsError>
</RECORD>
<IsError V="False"></IsError>
</RECORDS>

I've been all over the web for the last week and can find no examples this same situation. Does anyone have any help for me on this matter?

Thanks so much.

chad

    here is my slashdot code see if this will help

    <?
    require "slashwatch.inc";
    
    $backend 	= 	"http://slashdot.org/slashdot.xml";
    $siteid = "7564f467ef0cbb0c8415db848eaf1861";
    $stable = "Sites";
    
    $fpread = fopen($backend, 'r');
    
    if(!$fpread) {
    // 	Log failed connection to site
    //	echo "$errstr ($errno)<br>\n";
    //	exit;
    } else {
    		$connection = mysql_connect($hostname, $username, $password) OR die("Unable to connect to database");
    		@mysql_select_db( "$dbName") or die( "Unable to select database");
    
    	while(!feof($fpread) ) {
    		$buffer = ltrim(Chop(fgets($fpread, 256)));
    
    		if (($buffer == "<story>")) {
    			// Chop each line into appropiate variable
    			$title = ltrim(Chop(fgets($fpread, 256)));
    			$link = ltrim(Chop(fgets($fpread, 256)));
    			$time = ltrim(Chop(fgets($fpread, 256)));
    			$author = ltrim(Chop(fgets($fpread, 256)));
    			$depart = ltrim(Chop(fgets($fpread, 256)));
    			$topic = ltrim(Chop(fgets($fpread, 256)));
    			//#$time = time();
    			//$time = date("F j, Y, g:i a");
    
    			// Reg Ex Statements to Strip XML away
    			$title = ereg_replace( "<title>", "", $title );
    			$title = ereg_replace( "</title>", "", $title );
    			$link = ereg_replace( "<url>", "", $link );
    			$link = ereg_replace( "</url>", "", $link );
    			$time = ereg_replace( "<time>", "", $time);
    			$time = ereg_replace( "</time>", "", $time);
    			$topic = ereg_replace( "<topic>", "", $topic);
    			$topic = ereg_replace( "</topic>", "", $topic);
    			$description = $topic;
    
    			// Used to allow apstrophes in the database
                                $title = ereg_replace( "'", "\'", $title );
                                $description = ereg_replace( "'", "\'", $description );
    
    			// Check if headline is already in the database
    			$checkquery = "SELECT * FROM $table WHERE title = '$title' AND link = '$link'";
    			$checkresult = MYSQL_QUERY($checkquery);
    
    			// Insert if it isn't in database already        
    			if(MYSQL_NUM_ROWS($checkresult) == 0){
    			$session = md5(uniqid(rand()));
    			$query = "INSERT INTO $table VALUES('$session','$title','$link','$description','$time','$siteid')";
    			//#$query = "INSERT INTO $table SET id = '$session', title = '$title', link = '$link', description = '$description', hdate = '$time', site_id = '$siteid'";
    			$result = MYSQL_QUERY($query);
    			$sqltimeupdate = "UPDATE $stable SET last_update = '$time' WHERE site_id = '$siteid'";
                                MYSQL_QUERY($sqltimeupdate);
    			}
    		}
    	}
    	fclose($fpread);
    	mysql_close($connection);
    }
    #echo "Done! All Articles are now in the database.";
    ?>
    
    

      thanks,

      Looks good for entering data in db. I'm only looking to send the output directly to the screen.

        Write a Reply...