php-simple-html-dom-parser
php-simple-html-dom-parser copied to clipboard
Warning: file_get_contents(): stream does not support seeking
I have been experiencing the error "Warning: file_get_contents(): stream does not support seeking..." since I upgraded to PHP 7.1.x
Any fixes ?
https://github.com/sunra/php-simple-html-dom-parser/issues/11#issuecomment-61868883
quick fix:
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_URL, "http://example.com");
$html=curl_exec($curl);
$dom = new simple_html_dom(null, true, true, DEFAULT_TARGET_CHARSET, true, DEFAULT_BR_TEXT, DEFAULT_SPAN_TEXT);
$html=$dom->load($html, true, true);
In PHP 7.1, "Support for negative offsets has been added." to file_get_contents().
Change $offset = -1 by $offset = 0 in the simple_html_dom.php file:
function file_get_html($url, $use_include_path = false, $context=null, $offset = 0, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
@coudrak Thanks a lot
@coudrak Thanks a lot
HI dear's sir i'm using simple php dom but now im facing error, cloudflar security google recapcha , please help me how to fix this, thanks "Attention Required! | Cloudflare"
quick fix:
$curl = curl_init(); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); curl_setopt($curl, CURLOPT_URL, "http://example.com"); $html=curl_exec($curl); $dom = new simple_html_dom(null, true, true, DEFAULT_TARGET_CHARSET, true, DEFAULT_BR_TEXT, DEFAULT_SPAN_TEXT); $html=$dom->load($html, true, true);
HI dear's sir i'm using your simple php dom but now im facing error, cloudflar security google recapcha , please help me how to fix this, thanks "Attention Required! | Cloudflare"