我在下面粘贴了我的代码.我得到一个空字符串,没有卷曲错误或任何东西.
$service_url = "https://api.insight.ly/v2.1/Opportunities";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $service_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "-my-base64-encoded-api-key");
$data = curl_exec($ch);
curl_close($ch);
Run Code Online (Sandbox Code Playgroud)
因为Insightly API的文档说密码留空,我也试过了
curl_setopt($ch, CURLOPT_USERPWD, "-my-base64-encoded-api-key:");
Run Code Online (Sandbox Code Playgroud)
和
curl_setopt($ch, CURLOPT_USERPWD, "-my-base64-encoded-api-key: ");
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.谢谢.