[英]cURL with PHP - HTTP cURL to HTTPS
我有以下PHP, 可在本地工作(通过apache和localhost),但不能在我的主机上使用- $response
始终为空:
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$api_key = 'my_api_key';
$randomString = generateRandomString(10);
$endLabel = sha1(md5($randomString));
$user_id = $endLabel;
$amount_doge = '5';
$url = "https://dogeapi.com/wow/?api_key=".$api_key."&a=get_new_address&address_label=".$user_id;
$response = get_data($url);
我想知道是否可能是因为我托管在HTTP(无SSL选项)上,并且正在调用HTTPS域? 如果是这样,是否有办法解决? 我试过curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
但它似乎无能为力:(
尝试在$data = curl_exec($ch);
之后使用echo curl_error($ch)
$data = curl_exec($ch);
看看卷曲的意思会告诉你发生了什么
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.