I am at the learning stage of PHP. I have tried to invoke a sample webservice from a single PHP script. I started with StockQuote service. Below is the script I have written.
<?php
echo "Stock Quote service check";
require_once 'nusoap.php';
$wsdl="http://www.webservicex.net/stockquote.asmx?wsdl";
$client=new SoapClient($wsdl);
$param=array('symbol'=>'GOOG');
$response = $client->__soapCall('GetQuote', array($params));
$quotes = simplexml_load_string($response->GetQuoteResult);
echo $quotes;
//->Stock[0];
?>
Below is the warning i got:
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\nusoap.php on line 7384
Warning: Creating default object from empty value in C:\wamp\www\nusoap.php on line 75
Notice: Undefined variable: params in C:\wamp\www\URLExample.php on line 8
Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in C:\wamp\www\URLExample.php on line 9
Warning: simplexml_load_string(): exception in C:\wamp\www\URLExample.php on line 9
Warning: simplexml_load_string(): ^ in C:\wamp\www\URLExample.php on line 9
Notice: Trying to get property of non-object in C:\wamp\www\URLExample.php on line 11
When I am invoking the function manually I got the below output.
Please help to parse the response XML to get the < Stock> value. I found similar type of questions (Question No: #22060990) but nothing helps to my situation.