19

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

PeeHaa
  • 69,318
  • 57
  • 185
  • 258
Alix Axel
  • 147,060
  • 89
  • 388
  • 491

2 Answers2

8

SimpleTest provides you with similar functionality:

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

Aziz
  • 19,084
  • 5
  • 61
  • 68
Jon
  • 59,288
  • 31
  • 123
  • 150
8

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
  • 385,748
  • 76
  • 642
  • 654
  • 1
    +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