Grid object - this class handles requests to the list of banners. You can use it to search and filter in banners.

Methods:

  • all methods are inherited from Gpf_Rpc_GridRequest class, check it's documentation.

Example retrieving list of all banners (first 30 records)

 

//----------------------------------------------
// get recordset with list of banners

$request = new Pap_Api_BannersGrid($session);

//columns that you want to load (unless the default columns are enough)
$request->addParam('columns', new Gpf_Rpc_Array(array(array('id'), array('banner'), 
array('rtype'), array('campaignid'), array('destinationurl'), array('rstatus'), 
array('impressionsRaw'), array('clicksRaw'), array('ctrRaw'), array('salesCount'), 
array('scrRaw'), array('commissions'), array('size'), array('description'), array('rorder'), 
array('dateinserted'))));

// sets limit to 30 rows (maximum rows per one request is 500 rows). Starting with first row. Offset is not supported since version 5.11.8.1
$request->setLimit(0, 30);

// send request
try {
  $request->sendNow();
} catch(Exception $e) {
  die("API call error: ".$e->getMessage());
}

// request was successful, get the grid result
$grid = $request->getGrid();

// get recordset from the grid
$recordset = $grid->getRecordset();

// iterate through the records
foreach($recordset as $rec) {
  echo 'Banner name: '.$rec->get('name').'<br>';
}
×