Jump to content

Help With Goutte Php Web Scraping


ityler

Recommended Posts

Howdy,

 

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:

 

<?php
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:

 

????????G??

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
https://forums.phpfreaks.com/topic/271322-help-with-goutte-php-web-scraping/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.