S
S
Speakea1y12892019-05-24 16:05:28
PHP
Speakea1y1289, 2019-05-24 16:05:28

How to get certain tags with certain attributes and content in these tags from all HTML code using PHP?

Good afternoon!
There is, for example, the following code: https://pastebin.com/CYGnAWVb.
This code is taken and inserted into the textarea in the form html. After that, this code should be processed so that it leaves the img tag with the header_subj_logo class (from line 142 of the code) + the contents of this tag
4a2bc2346a.png
: this div: Clean up
967dabc74c.png
all remaining code! How to do it? The output should get the cleaned up code in a variable, something like this:

<img class="header_subj_logo" src="/img/headers/en.png" style="float:right; height:100px; margin:5px">
    <div class="prob_list">...</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Matveev, 2019-07-13
@ematveev

if the tags you need are known, then use the Html parser, find and select exactly them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question