从我获得SOAP调用var_dump的结果时,如下所示:
stdClass对象 ( [网站] =>排列 ( [0] => stdClass对象 ( [id] => 102728 [siteId] => 0 )
我想实现调用Sites数组来显示数据:
<?php
$opts = array(
'ssl' => array('ciphers'=>'RC4-SHA', 'verify_peer'=>false, 'verify_peer_name'=>false)
);`enter code here`
// SOAP 1.2 client
$params = array (
'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
'soap_version' => SOAP_1_2,
'trace' => 1, 'exceptions' => 1,
"connection_timeout" => 180,
'stream_context' => stream_context_create($opts) );
//disable wsdl cache
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient("http://www.example.com?WSDL",$params);
$result1=$client->getSiteInfo();
$zone = $result1->Sites;
if(isset($_POST['rayat'])){
echo $zone;
}
else {
?>
<form action="index.php" method="post">
<input id="rayat" name="rayat" size="10" type="text" value="" />
<input id="submit" name="submit" type="submit" value="submit" />
</form>
<?php
//$param = array('isbn'=>'0385503954');
// define path to server application
$opts = array(
'ssl' => array('ciphers'=>'RC4-SHA', 'verify_peer'=>false, 'verify_peer_name'=>false)
);
// SOAP 1.2 client
$params = array (
'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
'soap_version' => SOAP_1_2,
'trace' => 1, 'exceptions' => 1,
"connection_timeout" => 180,
'stream_context' => stream_context_create($opts) );
//disable wsdl cache
ini_set("soap.wsdl_cache_enabled", "0");
$server = '';
$client = new SoapClient("http://www.example.com?WSDL",$params);
$result1=$client->getSiteInfo();
$zone = $result1->Sites;
if(isset($_POST['rayat'])){
echo $zone;
}
else {
?>
<form action="champ.php" method="post">
<input id="rayat" name="rayat" size="10" type="text" value="" />
<input id="submit" name="submit" type="submit" value="submit" />
</form>
<?php
}
?>
<?php
}
?>
Above code give me result is 'Array'
答案 0 :(得分:0)
试图获得搜索值,它没有给予任何价值!请谅解我!
stdClass对象 ( [opsTrackerSites] =&gt;排列 ( [0] =&gt; stdClass对象 ( [managerName] =&gt; DECOMM-MGR,GC [techName] =&gt; dectech )
.
答案 1 :(得分:-1)
SOAP结果是一个对象数组,正如var_dump()告诉你的那样。如果你说你的SOAP调用总是只返回一个结果,你可以通过做类似的事情来作弊:
=SUMIF(F:F,"Ontario",H:H)
答案 2 :(得分:-1)
$ zone变量是一个数组,你不能回显数组,所以你必须循环遍历数组并回显每个单独的值或直接访问这些值,如另一个答案所示。