curl in PHP behave diferrently in the same DOM pages

24 views Asked by At

I run below code and it worked, but I see blank screen when I try with this URL : https://www.reddit.com/r/funny/comments/3aguyp/i_told_my_boyfriend_the_new_puppy_wasnt_allowed/

<?php include('simple_html_dom.php');
$html = getSslPage('https://www.reddit.com/r/pics/comments/3a53qw/grandmother_mother_and_daughter/');


function getSslPage($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_REFERER, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

$html = str_get_html($html);

echo $html;

The 2 page have the same DOM structure.

0

There are 0 answers