[英]consuming web service (for the first time) in php
It took me a while to get soap configured in php. 我花了一段时间才能在php中配置肥皂。 Now I'm just trying to learn about it.
现在我只是想了解它。 I'm using the web service here to learn:
我在这里使用Web服务来学习:
http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=19 http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=19
It says the WSDL is here: 它说WSDL在这里:
http://www.webservicex.net/stockquote.asmx?wsdl http://www.webservicex.net/stockquote.asmx?wsdl
and this is my code: 这是我的代码:
$client = new SoapClient('http://www.webservicex.net/stockquote.asmx?wsdl');
$result = $client->getQuote("AAPL");
echo $result;
I'm getting an error saying "Object of class stdClass could not be converted to string". 我收到一条错误消息:“类stdClass的对象无法转换为字符串”。 Now I realize that $result is an object, and I'm wondering how do I access data that the server populated?
现在我意识到$ result是一个对象,并且我想知道如何访问服务器填充的数据? I tried to understand the WSDL but I'm getting nowhere.
我试图了解WSDL,但是却一无所获。 Is it supposed to be something like:
是否应该是这样的:
$result->price
? ? (That doesn't work by the way...)
(顺便说一下是行不通的...)
Ideas? 想法?
var_dump()
your return and examine it. var_dump()
检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.