有个远程方法,我想用curl调用,但得不到response(request与response SOAP格式见下面的HTML)
恳请大家给个思路,实在搞不定......$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, "https://api.xxxxx.com/xxxxx/Webservice/OnlineAPI.asmx" );
$headers = array();
$headers[] = "CONTENT-LENGTH: 1000";
$headers[] = "Content-Type: application/soap+xml; charset=UTF-8";
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 1 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
$postargs="<?xml version=\"1.0\" encoding= \"utf-8\"?>
<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">
<soap12:Body>
<Version xmlns=\"http://www.xxxxx.com/\" />
</soap12:Body>
</soap12:Envelope>";
curl_setopt($ch, CURLOPT_POSTFIELDS, $postargs);
$response = curl_exec ( $ch );
curl_close ( $ch );
REQUESTPOST /nuriche/Webservice/OnlineAPI.asmx HTTP/1.1
Host: api.securefreedom.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Version xmlns="http://www.securefreedom.com/" />
</soap12:Body>
</soap12:Envelope>
RESPONSEHTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<VersionResponse xmlns="http://www.securefreedom.com/">
<VersionResult>
<RequestID>int</RequestID>
<Success>int</Success>
<Message>string</Message>
</VersionResult>
</VersionResponse>
</soap12:Body>
</soap12:Envelope>
恳请大家给个思路,实在搞不定......$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, "https://api.xxxxx.com/xxxxx/Webservice/OnlineAPI.asmx" );
$headers = array();
$headers[] = "CONTENT-LENGTH: 1000";
$headers[] = "Content-Type: application/soap+xml; charset=UTF-8";
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 1 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
$postargs="<?xml version=\"1.0\" encoding= \"utf-8\"?>
<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">
<soap12:Body>
<Version xmlns=\"http://www.xxxxx.com/\" />
</soap12:Body>
</soap12:Envelope>";
curl_setopt($ch, CURLOPT_POSTFIELDS, $postargs);
$response = curl_exec ( $ch );
curl_close ( $ch );
REQUESTPOST /nuriche/Webservice/OnlineAPI.asmx HTTP/1.1
Host: api.securefreedom.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Version xmlns="http://www.securefreedom.com/" />
</soap12:Body>
</soap12:Envelope>
RESPONSEHTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<VersionResponse xmlns="http://www.securefreedom.com/">
<VersionResult>
<RequestID>int</RequestID>
<Success>int</Success>
<Message>string</Message>
</VersionResult>
</VersionResponse>
</soap12:Body>
</soap12:Envelope>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货