Jump to content


Photo

Help With Goutte Php Web Scraping

scrape web php api

  • Please log in to reply
No replies to this topic

#1 ityler

ityler

    Newbie

  • New Members
  • Pip
  • 1 posts

Posted 28 November 2012 - 07:34 PM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com