I have connected to a web service and received data in XML file format. When I get a var_dump($response);
I get this array:
object(stdClass)#2 (1) {
["GetBookInfoByISBN"]=>
object(stdClass)#3 (14) {
["Success"]=>
bool(true)
["ResponseText"]=>
string(10) "Book Found"
["State"]=>
string(2) "CA"
["GetNumber"]=>
string(8) "1234"
["BookID"]=>
int(4) "12"
}
}
Now I am trying to get value of the BookID:
$soapclient = new SoapClient('http://wsf.com/BookWS/Book.asmx?WSDL');
$params = array('ISBN' => '1111');
$response = $soapclient->GetBookInfoByISBN($params);
var_dump($response);
<form>
<p><?php echo $response['BookID']; ?></p>
</form>
I am getting this error Fatal error: Cannot use object of type stdClass as array
which obviously means I am not accessing the data correctly.
I appreciate it any suggestion.