Jump to content

Help With Goutte Php Web Scraping


Recommended Posts



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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.