3
Contributors
8
Replies
51
Views
2 Years
Discussion Span
Last Post by Niloofar24
0

Well, like in python.... for example with a web crawler (with BeautifulSop if I'm correct) that we can get all html tags and text of a web page and then save it to a text file.

I want to do the same with php, give the url of a web page and receive it's html tags and contents.

Edited by Niloofar24

0

Would you give me an example please?
An example that you give a url to the script, and it gets all the html tags and text of that page and echo it on a file. I want the output to have text and html tags together.

0

@TexWiller, file_get_html() didn't work for me because of the html word in it and had to replace it with the word contents to get a result.

and also with:

foreach($html->find('img') as $element)
       echo $element->src . '<br>';

foreach($html->find('a') as $element)
       echo $element->href . '<br>';

there was no result and nothing appeaed on the page. (for www.google.com).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.