我需要通过api电话获得所有调查。 api提供商给我这个
Example curl Authorization:
curl –header “Content-Type: application/json” --header “Authorization: Basic
“API_KEY””-X GET “url”
我已经像这样设置了卷曲代码
$access = 'apikey';
$headers = array(
'Content-Type: application/json',
'Authorization: Basic'.$access
);
$url = 'url';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER ,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST ,0);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
但没有得到任何数据。任何人都可以告诉我,我做错了什么?