I
I
Icqibo2018-04-18 18:00:27
HTML
Icqibo, 2018-04-18 18:00:27

Parser html code without libraries, how?

Hello! I need an html parser of someone else's site so that I get all the values ​​of a specific tag (span, div), class, id
They are displayed in the form of an array
There is something like this:

$url = 'ссылка на сайт';
// НАЧАЛО
$ch = curl_init($url);
$html = curl_exec($ch);
curl_close($ch);
var_dump($html);
?>

But it displays the whole site

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-04-18
@Icqibo

Well, he does the right thing by displaying the entire site. You request the entire html by reference and then display it in its entirety.
And the process of writing a parser "without libraries" will lead to the fact that you write self-made libraries. Moreover, the chances that they will be better than competitors tend to zero.
And I'll tell you a secret: cURL is also a library. Can you rewrite it on sockets from scratch?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question