PHP中用CURL提交POST数据到https网站的问题
本人做了个CURL的段子,关键代码如下:static$ch=null;if(is_null($ch)){$ch=curl_init();curl_setopt($ch,C...
本人做了个CURL的段子,关键代码如下:
static $ch = null;
if (is_null($ch)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
}
curl_setopt($ch, CURLOPT_URL, $path);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_date);
// curl_setopt($ch, CURLOPT_HTTPHEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// run the query
$res = curl_exec($ch);
if ($res === false) throw new Exception('Curl error: '.curl_error($ch));
当$postdate=order_id=-1&partner=3372500&symbol=ltc_cny&sign=5248C2163DBFE01787239B2B4B9AF1E1时,会在curl_error中报错Error:Curl error: Unsupported protocol: https。可当$postdate=partner=3372500&sign=5248C2163DBFE01787239B2B4B9AF1E1时就会直接通过,这是为何呢。 展开
static $ch = null;
if (is_null($ch)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
}
curl_setopt($ch, CURLOPT_URL, $path);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_date);
// curl_setopt($ch, CURLOPT_HTTPHEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// run the query
$res = curl_exec($ch);
if ($res === false) throw new Exception('Curl error: '.curl_error($ch));
当$postdate=order_id=-1&partner=3372500&symbol=ltc_cny&sign=5248C2163DBFE01787239B2B4B9AF1E1时,会在curl_error中报错Error:Curl error: Unsupported protocol: https。可当$postdate=partner=3372500&sign=5248C2163DBFE01787239B2B4B9AF1E1时就会直接通过,这是为何呢。 展开
2个回答
展开全部
错误提示是不能支持https的协议。
http://stackoverflow.com/questions/4673154/curl-error-1-unsupported-protocol-https 救了我啊,谢天谢地。
说是 https 前面多了空格
http://stackoverflow.com/questions/4673154/curl-error-1-unsupported-protocol-https 救了我啊,谢天谢地。
说是 https 前面多了空格
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询