PHP code example of ropendev / google

1. Go to this page and download the library: Download ropendev/google library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ropendev / google example snippets


use rOpenDev\Google\SearchViaCurl;
use rOpenDev\Google\TestProxy;
use rOpenDev\Google\SafeBrowsing;

$Google = new SearchViaCurl('my kw');

$Google->setProxy('monproxie:monport:username:password')
         ->setTld('com')
         ->setLanguage('en')
         ->setSleep(6)  // to wait between 2 requests on Google
         ->setCacheFolder(null) // to disable storing in the /tmp folder
         //->setCacheExpireTime(86400) // 1 Day
         ->setNbrPage(10) // Nbr de page à extraire
         ->setParameter('num', 100) // to add a parameter in the search url
;

/**
 * @return array of array containing type, title, link values
 */
$Google->extractResults();

// Delete cache files
$Google->deleteCacheFiles();


/**
 * @return int
 */
$Google->getNbrResults()

/**
 * @return string explaining the error
 */
$Google->getError(); // $Google->cErrors contains curl errors

/* return an array */

TestProxy::go('monrpoxu'); // @return bool

SafeBrowsing::get('https://piedweb.com');// @return bool

use rOpenDev\Qwant\QwantSearchViaCurl;

$Qwant = new QwantSearchViaCurl('qwanturank');

/**
 * @return array of array containing type, title, link values
 */
$Qwant->extractResults();