Change language settings to use Topvisor in your preferred language. You can select and set a preferred language later in the Account settings. Change language settings to use Topvisor in your preferred language. ru Русский Apply

Example: API call results

In the below example, we'll get keywords with the get/keywords_2/keywords/ method.

 <?php

 use TopvisorSDK\V2 as TV;

 // replace "..." with a path to the autoload.php file if you use composer
 include(__DIR__.'/../../autoload.php');

 // write a path to SDK Topvisor, if you don't use composer
 //include_once('topvisor-sdk/src/V2/Fields.php');
 //include_once('topvisor-sdk/src/V2/Page.php');
 //include_once('topvisor-sdk/src/V2/Pen.php');
 //include_once('topvisor-sdk/src/V2/Session.php');

 $projectId = '%NN%'; // your project ID

 // creating a session
 $Session = new TV\Session();

 // initiating a call
 $selectorKeywords = new TV\Pen($Session, 'get', 'keywords_2', 'keywords');

 // setting the project_id parameter
 $selectorKeywords->setData(['project_id' => $projectId]);

 // request to get a keyword id and name
 $selectorKeywords->setFields(['id', 'name']);

 // filter keywords with 1, 2 or 3 tags
 $selectorKeywords->setFilters([
 TV\Fields::genFilterData('tags', 'IN', [1,2,3])
 ]);

 // sort keywords alphabetically
 $selectorKeywords->serOrders([
 TV\Fields::genOrderData('name', 'ASC')
 ]);

 // get 1,000 keywords in one API call
 $selectorKeywords->setLimit(1000);

 do{
 // processing request (display results page)
 $page = $selectorKeywords->exec();

 // processing error
 if(is_null($page->getResult())) return var_dump($page->getErrors());

 // $page - array of keywords
 foreach($page->getResult() as $resultItem){
 echo $resultItem->id.': '.$resultItem->name.'<br>';
 }

 // find missing keywords
 // (if this is the last page, $nextOffset is equal to NULL)
 $nextOffset = $page->getNextOffset();
 if($nextOffset) $selectorKeywords->setOffset($nextOffset);

 // keep on retrieving keywords until all pages retrieved
 }while($nextOffset);