0

in my project I use newest htmlsimpledom installed via composer. My curl script is logging into external b2b page and returns html. Problem is that i cannot process it with html_simple_dom because load function shows null after processing html. Here is my code:

//html returned via curl looks like this (displayed with dd() - laravel):

enter image description here

simple_html_dom:

public function __construct()
{
    $this->client = new \simplehtmldom\HtmlWeb();
}

private function login()
{
    $site1 = $curl->get_data_curl('https://main.b2b.somedomain.pl/pl/user/home', $data); //it's html from image above
    $getData = $this->client->load($site1); // this cause NULL
    $fields = $getData->find("input[id=username]"); // this throw error because null above
}

I'm not sure about what causing problem because on my server there is old piece of code where is the same html processed via html_simple_dom but with very old version of code like from 2012~ and without object way (using str_get_html())

Many thanks for any help and have a nice day.

UPDATE: calling $this->client->load('<html><body>Hello!</body></html>');** also cause null

meewog
  • 1,690
  • 1
  • 22
  • 26
Marek Kaliszuk
  • 577
  • 5
  • 21

1 Answers1

0

For future devs with same problem:

change:

new \simplehtmldom\HtmlWeb();

to:

new \simplehtmldom\HtmlDocument();
Marek Kaliszuk
  • 577
  • 5
  • 21