19

I was wondering if there was anything similar like Mechanize or BeautifulSoup for PHP?

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
Alix Axel
  • 151,645
  • 95
  • 393
  • 500

2 Answers2

9

I don't know how powerful BeautifulSoup is, so maybe this won't be as great ; but you could try using DOMDocument::loadHTML :

The function parses the HTML contained in the string source . Unlike loading XML, HTML does not have to be well-formed to load.

After using this, you should be able to access the HTML document using DOM methods -- including XPath queries.

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
  • 2
    +1 for the native suggestion, although doing XPath queries is several times more complex than doing the same thing in BeautifulSoup. – Alix Axel Aug 12 '09 at 06:17
8

SimpleTest provides you with similar functionality:

http://www.simpletest.org/en/browser_documentation.html

Aziz
  • 20,065
  • 8
  • 63
  • 69
Jonathan Holloway
  • 62,090
  • 32
  • 125
  • 150