How would i implement the following in the zend framework mvc?
$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);
$ReqBo开发者_Python百科dy = "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;
Something like this might do the trick :
$client = new Zend_Http_Client('http://testnl.etbxml.com/webservice/server_v21.php', array('httpversion' => Zend_Http_Client::HTTP_0));
$client->setParameterPost('request', $Request);
$response = $client->request('POST');
精彩评论