file_get_contents() how to fix error “Failed to open stream”, “No such file”

后端 未结 8 867
傲寒
傲寒 2020-12-01 17:35

I\'m getting the following error when I try to run my PHP script:

failed to open stream: No such file or directory in C:\\wamp\\www\\LOF\\Data.php on

相关标签:
8条回答
  • 2020-12-01 18:40

    Why don't you use cURL ?

    $yourkey="your api key";
    $url="https://prod.api.pvp.net/api/lol/euw/v1.1/game/by-summoner/20986461/recent?api_key=$yourkey";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    
    $auth = curl_exec($curl);
    if($auth)
    {
    $json = json_decode($auth); 
    print_r($json);
    }
    }
    
    0 讨论(0)
  • 2020-12-01 18:40

    I hope below solution will work for you all as I was having the same problem with my websites...

    For : $json = json_decode(file_get_contents('http://...'));

    Replace with below query

    $Details= unserialize(file_get_contents('http://......'));

    0 讨论(0)
提交回复
热议问题