imgur 上传错误

Imgur upload error

我正在使用 Imgur 从我的网站上传照片。

这是我的代码

$client_id = '*********';

$image = file_get_contents($_FILES['update_profile_photo']['tmp_name']);

$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 $client_id"));
curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => base64_encode($image)));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$reply = curl_exec($ch);

curl_close($ch);

$reply = json_decode($reply);

echo "<h3>Image</h3>";
printf('<img height="180" src="%s" >', $reply->data->link);

echo "<h3>API Debug</h3><pre>";
var_dump($reply);

当我第一次上传文件时,它打印出了图像。但是从下一次尝试开始,我无法查看该文件,在 laravel 中,我收到这样的错误

当清除 printf('<img height="180" src="%s" >', $reply->data->link); 检查 var_dump() 的结果时,它给了我这样的

object(stdClass)#219 (3) {
  ["data"]=>
  object(stdClass)#215 (3) {
    ["error"]=>
    object(stdClass)#212 (4) {
      ["code"]=>
      int(1016)
      ["message"]=>
      string(27) "Banned country attempt (IN)"
      ["type"]=>
      string(16) "Exception_Logged"
      ["exception"]=>
      array(0) {
      }
    }
    ["request"]=>
    string(13) "/3/image.json"
    ["method"]=>
    string(4) "POST"
  }
  ["success"]=>
  bool(false)
  ["status"]=>
  int(400)
}

我住在印度(信息中说被禁国家企图)
我想知道如何解决这个错误?为什么第一次能用,现在不行了。

我在本地主机上,还没有托管。
这是我代码的问题吗?

请告诉我如何解决这个问题

Imgur 在印度被屏蔽,因此您无法访问 API。

解决此问题的唯一可靠方法是通过代理访问 API。

来源:http://thehackernews.com/2015/01/indian-government-blocks-32-sites.html