U
U
user0name02018-08-19 23:39:02
PHP
user0name0, 2018-08-19 23:39:02

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

1 answer(s)
B
bkosun, 2018-08-19
@user0name0

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

https://github.com/Imangazaliev/DiDOM#getting-the-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question