PHP : file_get_contents($loc) fails

前端 未结 5 575
隐瞒了意图╮
隐瞒了意图╮ 2020-12-03 18:01

I just moved a project from localhost over to my remote server, and noticed that some of my scripts stopped working. Most importantly was one that relied upon file_get

5条回答
  •  甜味超标
    2020-12-03 18:40

    Also you can try curl:

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_URL, 'http://url.url');
    $result = curl_exec($curl);
    curl_close($curl);
    

    And you get what you want in $result.

提交回复
热议问题