Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: file_get_contents(): stream does not support seeking #41

Open
avecNava opened this issue Mar 23, 2017 · 7 comments
Open

Warning: file_get_contents(): stream does not support seeking #41

avecNava opened this issue Mar 23, 2017 · 7 comments

Comments

@avecNava
Copy link

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 ?

@sunra
Copy link
Owner

sunra commented Mar 24, 2017

#11 (comment)

@nekromoff
Copy link

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);

@coudrak
Copy link

coudrak commented Aug 4, 2017

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)

@Elessar1986
Copy link

@coudrak Thanks a lot

1 similar comment
@tianyingzhong
Copy link

@coudrak Thanks a lot

@adeelbhatti4454
Copy link

adeelbhatti4454 commented May 2, 2019

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"

@adeelbhatti4454
Copy link

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants