我是Zend_Soap_Client
的新手。我以下面的代码为例,并试图理解它背后的含义。我是否正确理解它连接到远程服务器并读取指定的数据?最后,据我了解,它应该保存这些数据在test.txt
。用Zend_Soap_Client读数据
我试着运行这段代码(我有必要的证书)。问题是没有数据保存到test.txt
。那么,有人可以向我解释这种技术吗?或者给我一个关于类似主题的好教程的链接?特别是,我对如何将必要的数据保存到本地XML文件或数组非常感兴趣。
P.S.如果我使用了一些不正确的定义,我很抱歉,因为正如我在开始时提到的,我是Zend_Soap_Client
及相关技术的新手。
$wsdl = 'tttest.wsdl';
$options = array(
'local_cert' => 'certificate.pem',
'soap_version' => SOAP_1_1
);
$client = new Zend_Soap_Client($wsdl, $options);
$p = array(
'endUserId' => 'demo',
'sendTime' => array('value' => date("Y-m-d H:i:s")),
'eaupId' => array('chainDate' => array('value' => $chaindate), 'sequenceNumber' => 1)
);
$webServices = $client->retrieveEAUPCDRs($p);
$line = $client->getLastResponse();
$line = substr($line, 110);
$line = substr($line, 0, -22);
$xml = simplexml_load_string($line);
$result = $xml->xpath('//@ns3:title | //ns2:beginPosition | //ns2:endPosition | //ns4:upperLimit | //ns4:lowerLimit | //ns8:conditionalRouteType');
$filename = 'test.txt';
if ($fh = fopen($filename, "r")) {
while (!feof($fh)) {
$line = fgets($fh);
if (strlen($line) != 0) {
$chars = explode(";", $line, 5);
$np[$chars[0]] = "$chars[3],$chars[2]";
}
}
fclose($fh);
};