Mi date una mano a prelevare i singoli dati (in php 5..) da un xml del genere?
Questo file lo ottengo dinamicamente dal sito Xignite (quotazioni/statistiche varie) tramite uno scrpt in php (ma le info che trovo sono scarse...)codice:<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetHistoricalSpotPriceRangeResponse xmlns="http://www.xignite.com/services/"> <GetHistoricalSpotPriceRangeResult> <Outcome>RegistrationError</Outcome> <Message> XigniteMetals: Maximum number of unregistered requests exceeded... </Message> <Identity>IP</Identity> <Delay>0</Delay> <Type>ARE</Type> <Currency>USD</Currency> </GetHistoricalSpotPriceRangeResult> </GetHistoricalSpotPriceRangeResponse> </soap:Body> </soap:Envelope>
Allego qui sotto il codice d'esempio che ho trovato...
E l'eventuale link alla stessa domanda posta nel forum PhpCodice PHP:// define the SOAP client using the url for the service
$client = new soapclient('http://www.xignite.com/xMetals.asmx?WSDL', array('trace' => 1));
// create an array of parameters
$param = array(
'Type' => "XAU",
'Currency' => "USD",
'StartDate' => "11/6/2010",
'EndDate' => "12/5/2010");
// call the service, passing the parameters and the name of the operation
$result = $client->GetHistoricalSpotPriceRange($param);
// assess the results
if (is_soap_fault($result)) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
// print the SOAP request
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->__getLastRequest(), ENT_QUOTES) . '</pre>';
// print the SOAP request Headers
echo '<h2>Request Headers</h2><pre>' . htmlspecialchars($client->__getLastRequestHeaders(), ENT_QUOTES) . '</pre>';
// print the SOAP response
$xmlString= '<h2>Response</h2><pre>' . htmlspecialchars($client->__getLastResponse(), ENT_QUOTES) . '</pre>';
http://forum.html.it/forum/showthrea...readid=1436142



Rispondi quotando