1

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!

Giffary
  • 3,060
  • 12
  • 50
  • 71

3 Answers3

2

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

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • 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 Mar 06 '10 at 20:13
1

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

TravisO
  • 9,406
  • 4
  • 36
  • 44
1

Use file_get_contents or cURL, 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

Jon Winstanley
  • 23,010
  • 22
  • 73
  • 116
Ankur Mukherjee
  • 3,777
  • 5
  • 32
  • 39