下面是我以前对Php的soap接口进行抓包分析出的结果,这个分析在当服务端或者客户端的Php没有安装soap模块时,可以使用构建xml的方式实现相同的功能
服务端:
- <?php
-
$data = $HTTP_RAW_POST_DATA;
-
$data = file_get_contents('php://input');
-
$server = new SoapServer(null, array('uri' => ""));
-
$server->addFunction("sendtask");
-
$server->handle($data);
-
function sendtask()
-
{
-
return "ok";
-
}
-
?>
客户端代码
- <?php
-
$client = new SoapClient(null, array('location' => "",
-
'uri' => ""));
-
$username="cdn@abc.cn";
-
$password=md5("123456");
-
$domain="";
-
$pathsizelist="/images/ad2.gif,4846,/images/ad3.gif,5788,/images/ico01.gif,1089,/images/logo.gif,1605";
-
echo $client->sendtask($username,$password,$domain,$pathsizelist);
-
?>
客户端发出的数据:
- POST /b.php HTTP/1.1
-
Host: api.abc.cn
-
Connection: Keep-Alive
-
User-Agent: PHP-SOAP/5.2.2
-
Content-Type: text/xml; charset=utf-8
-
SOAPAction: "#sendtask"
-
Content-Length: 766
-
-
-
-
-
-
cdn@abc.cn
-
e10adc3949ba59abbe56e057f20f883e
-
-
/images/ad2.gif,4846,/images/ad3.gif,5788,/images/ico01.gif,1089,/images/logo.gif,1605
-
-
-
当server中没有改函数时返回的结果
-
SOAP-ENV:ServerFunction 'sendtasks' doesn't exist
当server中有该函数时的结果
end
阅读(4366) | 评论(0) | 转发(0) |