File_get_contents (): stream does not support search / When did PHP behavior change about this?

When did the behavior of PHP about it change?

What version of PHP is this from?


Warning: file_get_contents (): the stream does not support searching in / simple _html_dom.php

Warning: file_get_contents (): Could not find position -1 in the stream in / simple _html_dom.php


include('parser/simple_html_dom.php');
$url = "https://en.wikipedia.org/wiki/Stack_Overflow";
$html = file_get_html($url);
if ($html !== false) {
  foreach($html->find('div#mw-content-text') as $item){
    $item->plaintext;
  }
}
+6
source share
4 answers

See file_get_contents (): stream does not support PHP search

You are working with a remote file. Search is supported only for local files.

You probably need to copy the file to the local file system before using file_get_html. It should work well on the local host.

+2

, , simple_html_dom.php, ( ).

75 simple_html_dom.php:

$contents = file_get_contents($url, $use_include_path, $context, $offset);

$offset:

$contents = file_get_contents($url, $use_include_path, $context);

. - , !:)

+38

function file_get_html(..., $offset = -1,...)

function file_get_html(..., $offset = 0,...)

simple_html_dom.php

+10

simple_html_dom.php $offset - 75 76. .

+4
source

Source: https://habr.com/ru/post/1015600/


All Articles