PHP code example of simonfunk / dataforseo-clientv3

1. Go to this page and download the library: Download simonfunk/dataforseo-clientv3 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/ */

    

simonfunk / dataforseo-clientv3 example snippets


  
return $config = [  
   'DATAFORSEO_LOGIN' => 'login',  
   'DATAFORSEO_PASSWORD' => 'password',  
   'timeoutForEachRequests' => 120,  
   'apiVersion' => '/v3/',  
   'url' => 'https://api.dataforseo.com',  
 // You can set extra paths for Entities  
 // For all entity we use namespace: DFSClientV3\Entity\Custom
 // Last index will have the priority
   'extraEntitiesPaths' => [  
      'your full path to extra entity',  
      'your full path to extra entity'  
  ],  
];

  
ent = new DFSClientV3\DFSClient();  
$client->setConfig('config.php');  
  
// You will receive detailed information about your API usage  
$model = new \DFSClientV3\Models\CommonApi\User();  
// You can get an object whose essence is described in the appropriating entity 
// (attention, may contain outdated data)
$res = $model->get();  
print_r($res);  
// You can get the JSON answer  
$res = $model->getAsJson();  
print_r($res);  
  
  
// You will receive SERP data specific to the indicated keyword, search engine, and location parameters
$model = new \DFSClientV3\Models\SerpApi\SettingSerpLiveAdvanced();  
$model->setSe("google");  
$model->setSeType("organic");  
$model->setKeyword("seo");  
$model->setLocationCode(2840);  
$model->setLanguageCode("en");  
$res = $model->getAsJson();  
print_r($res);

public
   config.php
   index.php
vendor
 composer.json
 composer.lock