I got a blank screen after I run below code
<?php include('simple_html_dom.php');
$html = getSslPage('https://www.reddit.com/r/nottheonion/comments/3aev89/kim_jongun_claims_to_have_cured_aids_ebola_and/');
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 hardest part of debugging it is it work sometime with other url. I wonder why coz the pages have the same DOM structure. Anyone have idea why is it happening?
It is because the html string is too large and simple_html_dom has a maximum limit that it can parse. Here's what you can do to increase the limit.
Open the simple_html_dom.php and change this line
define('MAX_FILE_SIZE', 6000000);
to something more.. Try
define('MAX_FILE_SIZE', 60000000); // add a zero at the end
This should solve the problem. Let me know, if that's not the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With