php通过curl调用webservice
webservice数据用xml生产,传输时候要设置
$header[] = "Content-type: text/xml";
public function sendC()
{
$url = "http://10.10.13.143:8880/htesb";
// $header = ['consumerCode' => 42, 'interfaceCode' => 290002, 'reqSN' => '7410f9f7a5c07', 'empCode' => '?',
// 'branchCode' => '?', 'mac' => '?'];
// $parameters = ['userName' => 'xsale', 'passWord' => 'xsale123456', 'productID' => 481, 'clientSeq' => 111111,
// 'subBranch' => 321, 'phone' => '17521275660', 'content' => '亲爱的USERONE,您好,您的验证码为923560,三分钟有效!',
// 'phoneCount' => 1];
$post = <<<EOT
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hts="http://www.htsec.com/">
<soapenv:Header/>
<soapenv:Body>
<hts:request>
<!--Optional:-->
<messageRequestHead>
<!--Optional:-->
<consumerCode>42</consumerCode>
<!--Optional:-->
<interfaceCode>290002</interfaceCode>
<!--Optional:-->
<reqSN>7410f9f7a5c07</reqSN>
<!--Optional:-->
<empCode>?</empCode>
<!--Optional:-->
<branchCode>?</branchCode>
<!--Optional:-->
<mac>?</mac>
</messageRequestHead>
<!--Optional:-->
<messageRequestBody>
<userName>xsale</userName>
<passWord>xsale123456</passWord>
<productID>481</productID>
<clientSeq>111111</clientSeq>
<!--Optional:-->
<subBranch>321</subBranch>
<!--Optional:-->
<phone>17521275660</phone>
<!--Optional:-->
<content>亲爱的USERONE,您好,您的验证码为923560,三分钟有效!</content>
<phoneCount>1</phoneCount>
</messageRequestBody>
</hts:request>
</soapenv:Body>
</soapenv:Envelope>
EOT;
$header[] = "Content-type: text/xml";
var_dump(curl($url, $header, $post));
}