Skip to content

Set tasks onpage

jovixv edited this page Nov 6, 2018 · 3 revisions

Setting Tasks OnePageApi

Original docs can be found at https://docs.dataforseo.com/#setting-tasks

Attention Please notice that the get() method isn't used. The static call ::getAfterMerge() is used instead. Note that the first setOpt() call should be static

Method: ::getAfterMerge($pool) - creates a single payload out of the list of objects, makes a single call to the API, whereas the payload contains arrays with postIds or without, and returns an object ResponseCollection

Use case with several arrays in the payload.

require_once '../../../vendor/autoload.php';

use DFSClient\DFSClient;
use DFSClient\Models\OnPageApi\SettingTasks;


$DFSClient = new DFSClient('login','password');
$model     = new SettingTasks();

for($i=0;$i<1;$i++){
    $pool[] = $model::setOpt('site', 'ranksonic.com')->setOpt('crawl_max_pages', 10);
}

$completed = SettingTasks::getAfterMerge($pool);

if (!$completed->isSuccessful())
    dd($completed);

foreach ($completed as $key=>$item){
    dump($item);
}

Getting Started

  1. Home
  2. Installation
  3. Configuration
  4. Base Usage
  5. Response Collection
  6. Abstract Model

DataForSEO APIs

Clone this wiki locally