i have soap mod enabled on php5. i'm trying to get the spot price for gold in USD. i found the service here:
http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=8
my code is as follows:
<?php
$client = new SoapClient(
"http://www.webservicex.net/LondonGoldFix.asmx?wsdl"
,array(
"proxy_host" => "proxy",
"proxy_login" => "user",
"proxy_password" => "password",
"proxy_port" => 8080,
"trace" => 1, "exceptions" => 0)
);
print "functions----<br>";
$functions = $client->__getFunctions();
print_r($functions);
print "<br><br>types----<br>";
$types = $client->__getTypes();
print_r($types);
$response = $client->GetLondonGoldAndSilverFix("Gold_AM_USD");
print "<br><br>response----<br>";
print_r($response);
print "<br><br><pre>\n";
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "</pre>";
?>
you can remove the proxy server, user, pass and port to try the code yourself. i have tried calling the method with no params, a 1, and the string above. the response i get is 0s and failure.
response----stdClass Object ( [GetLondonGoldAndSilverFixResult] => stdClass Object ( [Gold_AM_USD] => 0 [Gold_AM_STG] => 0 [Gold_AM_EUR] => 0 [Gold_PM_USD] => 0 [Gold_PM_STG] => 0 [Gold_PM_EUR] => 0 [Silver_CENTS] => 0 [Silver_PENCE] => 0 [Silver_EUR] => 0 [Status] => Failed ) )
this is my first time trying to do something like this. please advise! thanks. 🙂