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

Christian Schaefer's Blog:
Using PHP Web Scraper Goutte in a Console Task in a Silex project
Oct 10, 2011 @ 13:26:24

In a recent post to his blog Christian Schaefer shows how to use the Goutte tool (a web scraper) to pull information from one site and use it in another Silex-powered one. His tutorial uses a custom service provider for the integration.

Since I discovered the free Facebook App hosting by heroku I keep wanting to make something useful out of it. So I thought about a small service app. Without going into details yet about its nature there was one immediate problem to be solved. How to get hold of the data? So I thought to scrape it off some website. I know this isn't very nice but unfortunately there is no feed I can use.. And how to best scrape a website? Use Goutte!

All you'll need is two things - the goutte.phar and Silex phar files. The code for the service provider is a simple registration of namespaces. With that integrated, it's as simple as making a client object and calling it with a URL.

tagged: silex goutte webscraping tutorial serviceprovider phar

Link:

php|architect:
Introducing four new PHP 5.3 components and Goutte, a simple web scraper
Apr 23, 2010 @ 19:50:18

On the php|architect blog today there's a new post from Ryan Weaver about some of the new components that've been added to the Symfony framework - BrowserKit, CssSelector, DomCrawler, Process and a project that uses them all, Goutte.

To support symfony 2’s development, Fabien Potencier – the lead developer of the symfony framework – has released four new PHP 5.3 based components. [...] Though these components will be used by Symfony 2, they’re built to be standalone components that can be easily used in any PHP 5.3 project.

The post lists each of them out including features and some sample code as well as a brief look (mostly code) at using to locate specific contents in a page.

tagged: browserkit cssselector domcrawler process symfony component goutte

Link:


Trending Topics: