file_get_contents和curl都不起作用

vin*_*avn 7 php curl file-get-contents phpinfo

我刚刚使用file_get_contents来检索我网站上的数据.但它不会返回任何东西.

file_get_contents("https://www.google.co.in/images/srpr/logo11w.png")
Run Code Online (Sandbox Code Playgroud)

当我在我的本地环境中使用它时,它返回值.

我也尝试在我的网站上卷曲,以确定它是否返回任何东西.但它表明

禁止
您无权访问.

我用Google搜索,我发现了一些提示.我启用了allow_url_fopenallow_url_include.

但没有任何效果.

我试过的卷曲代码

function curl($url){ 
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  $return = curl_exec($ch); curl_close ($ch);
  return $return;
} 
$string = curl('https://www.google.co.in/images/srpr/logo11w.png');
echo $string;
Run Code Online (Sandbox Code Playgroud)

Sha*_*ran 2

道路file_get_contents()...

<?php
header('Content-Type: image/png');
echo file_get_contents("https://www.google.co.in/images/srpr/logo11w.png");
Run Code Online (Sandbox Code Playgroud)

道路cURL...

<?php
header('Content-Type: image/png');
function curl($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
    $return = curl_exec($ch); curl_close ($ch);
    return $return;
}
$string = curl('https://www.google.co.in/images/srpr/logo11w.png');
echo $string;
Run Code Online (Sandbox Code Playgroud)

输出 :

在此输入图像描述