1
我將如何在zend框架mvc中實現以下內容?xml請求/響應zend框架
$Request = '<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Easytobook>
<Request target="test">
<Authentication username="test" password="test">
<Function>GetCityInfo</Function>
</Authentication>
<CityId>1</CityId>
</Request>
</Easytobook>
</soap:Body>
</soap:Envelope>';
$socket = @fsockopen("testnl.etbxml.com", 80, &$errno, &$errstr);
$ReqBody = "request=".$Request;
$HTTPHeader = "POST /webservice/server_v21.php HTTP/1.0\n";
$HTTPHeader .= "Host: testnl.etbxml.com \n";
$HTTPHeader .= "Content-Type: application/x-www-form-urlencoded\n";
$HTTPHeader .= "Connection: Close\n";
$HTTPHeader .= "Content-Length: " .strlen($ReqBody) ."\n\n";
$HTTPHeader .= $ReqBody;
fwrite($socket, $HTTPHeader);
$Result = '';
while (!feof($socket))
{
$Result.= fread($socket, 10240);
}
echo $Result;
嗨,這是否也該響應是純XML,沒有HTTP或者工作?我試過這個,並且在zend_client_adaptor_socket讀取函數中得到了超時錯誤 – cwhisperer 2012-09-19 13:29:34