News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Script-Tutorials.com:
How to parse web pages using XPath
April 21, 2011 @ 09:49:59

On the Script-Tutorials.com site there's a new article showing you how to use XPath to parse web pages, complete with screenshots of the page and the code to make it happen.

Today I will tell you how you can make parsers of remote HTML pages (in PHP). In this article I will show you how to perform xpath queries to Web pages. XPath - a query language to elements of xml or xhtml document. To obtain the necessary data, we just need to create the necessary query. For the work, we also need: browser Mozilla Firefox, firebug and firepath plugins. For our experiment, I suggest this webpage Google Sci/Tech News. Of course you can choose any other web page too.

They provide two demos and a downloadable package with everything you need. The script pulls in the page as a DOM document (which works as long as it's correctly formatted XML) and spits back out the matches from a few different XPath expressions. There's all sorts of sites out there that can help you with examples of other XPath expressions and syntax.

0 comments voice your opinion now!
xpath tutorial parse html website


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: PHP and Regular Expressions 101

PHPBuilder.com: BitMasks: Emulate Unix Permissions in PHP (Quickly)

NETTUTS.com: CodeIgniter From Scratch: Day 3. Sending Emails and Attachments

PHPBuilder.com: Search Google Books with the Zend Framework's Zend_Gdata Component

NETTUTS.com: Building the Back-End of a Photo Site


Community Events





Don't see your event here?
Let us know!


interview introduction unittest community code testing refactor laravel series api podcast release threedevsandamaybe install developer opinion framework language list wordpress

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework