News Feed
Sections




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

Juozas Kaziukenas' Blog:
Web scraping with PHP and XPath
February 18, 2009 @ 10:28:08

In this new post to his blog Juozas Kaziukenas takes a look at one method for getting the information out of a remote page - parsing it with PHP and XPath (assuming the page is correctly formatted).

When I was writing about how I use web scraping, I was still hadn't tried using Xpath (shame on me). [...] It turned out, that using Xpath is extremely easy, really. When you master it, you can do everything in seconds. Yes, you need to know how XML works and how to write correct Xpath queries (brief explanation of Xpath syntax is available at W3Schools), but hey - these topics are in 1st year of university.

He includes both some sample code (to fetch a titles and prices for cameras from bhphotovideo.com) and a link to a XPath checker you can use to ensure that your query is correctly formatted. It's good that he also includes a quick reminder about the ethical issue with web scraping - it could be considered stealing depending on where the information comes from and who is providing it.

1 comment voice your opinion now!
web scraping xpath tutorial price title ethical steal information


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: "Building Your Own Ajax Web Applications" (Book Review)

Michelangelo van Dam's Blog: Zend Framework context switching for HTML content

Tibo Beijen's Blog: Using Zend_Form without Zend Framework MVC

DevShed: Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP

Derick Rethans' Blog: Xdebug and tracing memory usage


Community Events

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


community framework language podcast library release php7 conference opinion unittest version laravel laravel5 api series interview voicesoftheelephpant example introduction extension

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