PHP5 giving failed to open stream: HTTP request failed error when using fopen

前端 未结 5 1279
渐次进展
渐次进展 2021-01-02 06:22

This problem seems to have been discussed in the past everywhere on google and here, but I have yet to find a solution.

A very simple fopen gives me a

5条回答
  •  耶瑟儿~
    2021-01-02 07:12

    It sounds like your configuration isn't allowed to use file functions, which is common these days because of security concerns. If you have the cURL libraries available to you, I would recommend trying those out.

    PHP: cURL

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://www.google.ca/");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $file = curl_exec($ch);
    curl_close($ch);
    
    echo $file;
    

提交回复
热议问题