PHP Classes


Recommend this page to a friend!
  Classes of Vinícius Dias  >  PHP Google Search Crawler  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Google Search Crawler
Perform searches and retrieve results from Google
Author: By
Last change: updated
Date: 2 years ago
Size: 3,287 bytes


Class file image Download

Google Crawler

Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality License

A simple Crawler for getting Google results.

This component can be used to retrieve the 100 first results for a search term.

Since google detects a crawler and blocks the IP when several requests are made, this component is prepared to use some online proxy services, such as


Install the latest version with

$ composer require cviniciussdias/google-crawler


Crawler class constructor prototype

    SearchTermInterface $searchTerm, GoogleProxyInterface $proxy = null,
    string $googleDomain = '', string $countryCode = ''


  • $searchTerm Term that will be searched on Google
  • $proxy Online proxy service that will be used to access Google [optional]
  • $googleDomain Your country specific google domain, like,, etc. [optional]
  • $countryCode Country code that will be added to `gl` parameter on Google's url, indicating the location of the search. E.g. 'BR', 'US', 'DE' [optional]


Without proxy

use CViniciusSDias\GoogleCrawler\{
    Crawler, SearchTerm

$searchTerm = new SearchTerm('Test');
$crawler = new Crawler($searchTerm); // or new Crawler($searchTerm, new NoProxy());

$resultList = $crawler->getResults();

With some proxy

use CViniciusSDias\GoogleCrawler\{
    Crawler, SearchTerm, Proxy\CommonProxy

$searchTerm = new SearchTerm('Test');
$commonProxy = new CommonProxy('');
$crawler = new Crawler($searchTerm, $commonProxy);

$resultList = $crawler->getResults();

More details on proxies

To know more details about which proxies are currently supported, see the files inside tests/Functional folder. There you'll see all the available proxies.

Iterating over results

foreach ($resultList as $result) {
    $title = $result->getTitle();
    $url = $result->getUrl();
    $description = $result->getDescription();



  • This component works with PHP 7.2 or above
  • This component requires the extension php-ds to be installed


Vinicius Dias (ZCE) - - -


This component is licensed under the GPL v3.0 License - see the LICENSE file for details

For more information send a message to info at phpclasses dot org.