PHP cURL-无法识别响应消息

时间:2019-04-02 12:32:33

标签: php curl http-headers gzip httpresponse

我正在尝试使用php curl通过httpresponse获取数据,但是我只得到了难以辨认的字符。

我已经尝试修改字符集,但问题仍然存在。我什至尝试使用SoapUI和Postman之类的补充程序,但是它们有相同的问题。

有人遇到过这个困难吗?

$url = 'http://XXXXX.com';

$xml = '<XXXXX><user>X</user><password>X</password></XXXXXX>';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/xml"));
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); 
curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); 
curl_setopt($ch, CURLOPT_HEADER, TRUE);


$result = curl_exec($ch); 
curl_close($ch);

echo $result;



HTTP/1.1 200 OK  
Cache-Control: private 
Transfer-Encoding: chunked
Content-Type: text/html 
Content-Encoding: gzip Vary: Accept-Encoding
Server: Microsoft-IIS/8.5 
X-AspNet-Version: 4.0.30319 
X-Powered-By: ASP.NET Date: Tue, 02 Apr 2019 12:26:12 GMT

PK-FK�N}:��������(d2737cfa-811a-48e9-be75-808ce95f727d.txt:%���n�6

0 个答案:

没有答案