tags:

views:

74

answers:

3

Hi I want to analyze HTML page by following example.

  1. I can put url page to textfield then press enter.
  2. I get some text from HTML page such as title, h1, div id="do" or so on.

How I can do it by using PHP?

Thanks!

+1  A: 

With file_get_contents() or the like and an HTML parser.

Ignacio Vazquez-Abrams
Don't use file_get_contents. According to this benchmark cURL is quite a bit faster. http://stackoverflow.com/questions/555523/file-get-contents-vs-curl-what-has-better-performance
The Pixel Developer
I don't know why he's being downvoted. Altough it may be true curl is faster, his answer is valid.
metrobalderas
Before you make *wild* accusations, I neither down-voted or up-voted. The answer is far too short for my liking.
The Pixel Developer
+1  A: 

You want to use PHP's curl functions, here's a quick tutorial.

TravisO
+1  A: 

Use file_get_contents()or cURL and then use the explode functions to get data from the tags if using file_get_contents OR use "regex" for the particular html tag for getting the data

Ankur Mukherjee