Jump to content


Help With Goutte Php Web Scraping

scrape web php api

  • Please log in to reply
No replies to this topic

#1 ityler



  • New Members
  • Pip
  • 1 posts

Posted 29 November 2012 - 12:34 AM


I just started experimenting with Goutte - found here on Github: https://github.com/f...ore-information

I followed the examples almost exactly but here is my code anyways:

require_once 'goutte.phar';

use Goutte\Client;

$client = new Client();

$crawler = $client->request('GET','http://www.cnn.com/');

$nodes = $crawler->filter('.error_list');
if ($nodes->count())
// die(sprintf("Authentication error: %s\n", $nodes->text()));

// This part of the code I havent even changed yet being I can't get passed this problem :/
printf("Nb tasks: %d\n", $crawler->filter('nb_tasks')->text());


Here is what is displayed on the page when running the php code:

Fatal error: Class 'Goutte\Client' not found in /Applications/XAMPP/xamppfiles/htdocs/scrape.php on line 7.

I have used PHP in the past but im a bit rusty, my apologies if it is something simple. I checked the Github issues and their doesn't appear to be any issues related to the problem I am currently having.

I have the goutte.phar file in the same directory as the file with the code above so I am unsure why the fatal error is occurring on not finding the Client class?

Thanks for the help!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users