Skip to content
Advertisement

cURL shows since few days blank page

i use curl. Since a few days curl show’s me a blankpage.

The mainpage /kenteken/ he show’s without problem. But if there is text like /kenteken/TF172H it show’s a blankpage.

I hope some one can help.

$ktk = $_GET['kenteken'];
// create curl resource
        $ch = curl_init();

        // set url
        curl_setopt($ch, CURLOPT_URL, "https://finnik.nl/kenteken/" . $ktk);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
        curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com");
        curl_setopt($ch, CURLOPT_AUTOREFERER, true);

        // $output contains the output string
        $output = curl_exec($ch);

        // close curl resource to free up system resources
        curl_close($ch);      
print_r($output);

Advertisement

Answer

If you go to the URL in your browser with the Developer Console – Network tab open, you’ll see it’s being redirected to a lowercase URL. You can add this line to have it follow the redirect:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement