Php cURL请求从imgur api获取空响应

Php cURL请求从imgur api获取空响应,php,api,curl,xampp,imgur,Php,Api,Curl,Xampp,Imgur,这是我必须匿名上传到imgur的引用块。它在mac os机器上的xampp上工作,但在windows上的xampp上不工作。我还了解有关windows xampp上的curl的以下内容: $image = file_get_contents($_FILES['upload']['tmp_name']); $id = 'myid'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.imgur

这是我必须匿名上传到imgur的引用块。它在mac os机器上的xampp上工作,但在windows上的xampp上不工作。我还了解有关windows xampp上的curl的以下内容:

    $image = file_get_contents($_FILES['upload']['tmp_name']);
    $id = 'myid';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://api.imgur.com/3/image.json');
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Client-ID ' . $id));
    curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'image' => base64_encode($image) ));
    $response = curl_exec($ch);
    curl_close($ch);
    $response = json_decode($response);

我想这两台计算机上的卷曲设置有些不同。如果你能给我指路,我将不胜感激!提前谢谢

这是一个SSL问题。请在调用
curl\u exec
之前尝试以下行

-it is enabled
-it works when i try to grab the content of an url
-it doesnt work when i try to make DELETE request to remove an anonymous image(the same code works on the mac os xampp)

(您可以添加
var_dump($response);
以查看服务器响应。)

如果查看
phpinfo()
,则有一个称为“curl”的部分。尝试比较这些错误。查看输出了哪些cURL错误
echo cURL_error()CA可能有问题,在这种情况下,您需要使用正确的cURL函数指向它。可怕的无耻插件:您可以使用Runscope检查请求/响应数据,而不必在代码中转储响应。通过这种方式,您可以看到实际的API响应是什么。我是否接受向上投票的答案?对不起,这是我的第一个问题,我还没有足够的代表投票支持这个答案。但是,我保证我会在可能的时候再回来。复选标记应该在投票按钮下面。。像这样
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);