来自curl php

时间:2015-08-20 07:25:06

标签: php curl

我正在尝试使用curl发布一个xml字符串。

这是代码

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 120);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($curl, CURLOPT_ENCODING, 'utf-8');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'SOAPAction:""',
    'Content-Type: text/xml; charset=utf-8',
));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');                            
curl_setopt($curl, CURLOPT_SSLCERT, '.............');
curl_setopt($curl, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($curl, CURLOPT_SSLKEY, '.............');
curl_setopt($curl, CURLOPT_SSLKEYPASSWD, '');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlData);
curl_setopt($curl, CURLOPT_HEADERFUNCTION, 'read_header'); // get header
$result = curl_exec($curl);

这是我继续得到的结果

资源ID#4

我刚开始卷曲,但我正在努力研究它。这是我的curl php中的正确代码吗?

我希望这个样本响应来自curl:

{"status_code":"....","message":"..........."}

0 个答案:

没有答案