Problem with crawler

1

I'm trying to make a simple crowler that catches the temperature, just to study, I'm using simple_html_dom to read the page, but in the file_get_html function of the link above, presents some errors, and I'm not understanding why. The codes I use for temperatura.class have been taken from this video . I'm even using the same link to find the temperature, just changing the place. I use php 7.2.

(Line 75 will be marked in the code).

1st error:

  

Warning: file_get_contents (): stream does not support seeking in C: \ wamp64 \ www \ crowler_php \ simple_html_dom.php on line 75

2nd error:

  

Warning: file_get_contents (): Failed to search for position -1 in the stream in C: \ wamp64 \ www \ crowler_php \ simple_html_dom.php on line 75

3rd error:

  

Warning: preg_match_all (): Unknown modifier '>' in C: \ wamp64 \ www \ crowler_php \ temp.class.php on line 26

temperature.class:

require_once './simple_html_dom.php';

class Temperatura {

    public function __construct() {
        $this->getTemperatura("http://www.tempoagora.com.br/previsao-do-tempo/sp/Cotia/");
    }

    public function getTemperatura($url){

        $html = file_get_html($url);

        preg_match_all('/<div class=\"item\">(.*?)<\/div/>', $html, $resultado);
        echo '<pre>';
        print_r($resultado);
    }
}

$t = new Temperatura();

The code for simple_html_dom.php is here

    
asked by anonymous 27.07.2018 / 06:57

0 answers