HTTP request error! HTTP / 1.1 416 Requested range Not satisfied in php file

how can i solve this error.
file_get_contents(http://www.example.com/name/j/92801): failed to open stream: HTTP request failed! HTTP/1.1 416 Requested Range Not Satisfiable in line
Here is the php file code.
echo $file = file_get_contents("http://www.example.com/name/j/92801");
I am using wamp server 2.4

+4
source share
1 answer

primarily included allow_url_fopenin php.ini file? and secondly, it's better to use curl heres a bit to help you

function curl($url , $ua = FALSE){
            if($ua == false){
                $ua = $_SERVER['HTTP_USER_AGENT'];
            }
            $ch = curl_init();
            curl_setopt($ch , CURLOPT_URL , $url);
            curl_setopt($ch , CURLOPT_RETURNTRANSFER , true);
            curl_setopt($ch , CURLOPT_FOLLOWLOCATION , true);
            curl_setopt($ch , CURLOPT_USERAGENT , $ua);
            return curl_exec($ch);
        }
0
source

All Articles