Answer the question
In order to leave comments, you need to log in
How to send User-Agent when using DiDOM?
I send via curl User-Agent, the output of curl_exec is what it should be. But DiDOM sees the page differently and, as I understand it, does not even "know" that curl sent something. How to be? You can pass curl_exec to:
new Document(' site ', true); - but how?
And a mini question: how to use first()?
Answer the question
In order to leave comments, you need to log in
Built-in methods? No, it's impossible.
https://github.com/Imangazaliev/DiDOM/blob/master/...
https://github.com/Imangazaliev/DiDOM/blob/master/...
https://github.com/Imangazaliev/DiDOM/ blob/master/...
You need to get the page page using cURL/Guzzle, etc., and then:
$document = new Document($html);
// OR
$document = new Document();
$document->loadHtml($html);
$html = '<div>Foo<span>Bar</span><!--Baz--></div>';
$document = new Document($html);
$div = $document->first('div');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question