我正在尝试使用 php 将 SOAP 消息发送到服务。
我想用 fsockopen 来做,这是代码:
<?php
$fp = @fsockopen("ssl://xmlpropp.worldspan.com", 443, $errno, $errstr);
if (!is_resource($fp)) { die('fsockopen 调用失败,错误号 ' . $errno . '.' . $errstr); }
$soap_out = "POST /xmlts HTTP/1.1\r\n"; $soap_out .= "主机:212.127.18.11:8800\r\n"; //$soap_out .= "用户代理:MySOAPisOKGuys \r\n"; $soap_out .= "内容类型: text/xml; charset='utf-8'\r\n"; $soap_out .= "内容长度:999\r\n\r\n"; $soap_put .= "连接:关闭\r\n"; $soap_out .= "SOAPAction:\r\n"; $soap_out .= 'Worldspan 这是一个测试';
if(!fputs($fp, $soap_out, strlen($soap_out)))
echo "could not write";
echo "<xmp>".$soap_out."</xmp>";
echo "--------------------<br>";
while (!feof($fp))
{
$soap_in .= fgets($fp, 100);
}
echo "<xmp>$soap_in</xmp>";
fclose($fp);
echo "ok";
上面的代码只是挂起。如果我删除了它的类型,那么我想问题出在 $soap_in .= fgets($fp, 100)
关于正在发生的事情的任何想法