If some affiliates wish to obtain their banner codes via API so that they add all their banners to their page(s) dynamically and the fastest way possible, then the following php API example will come in handy.
<?php define('URL_TO_PAP','https://URL_To_PostAffiliatePro'); //URL to Post Affiliate Pro (network) without any trailing slash define('AFFILIATE_USERNAME','affiliate@example.com'); //affiliate username define('AFFILIATE_PASSWORD','demo'); //affiliate password define('API_FILE','PapApi.class.php'); //the PapApi.class.php file can be downloaded in the merchant panel: Tools>Integration>API Integration>Download PAP API //make sure the PapApi.class.php file is uploaded in the same directory as this script itself. $session = papAffiliateLogin(); if (!$session){ die('Banner codes cannot be obtained due to failed login attempt'); } $bannerCodes = getBannerCodes($session); //obtaining the banner codes as a genric HTML code that is directly executed $bannerCodesNeatCode = getBannerCodes($session,'Y'); //utlizing https://php.net/htmlspecialchars if ($bannerCodes) { foreach ($bannerCodes as $code){ echo $code."<hr>"; } } if ($bannerCodesNeatCode) { foreach ($bannerCodesNeatCode as $code){ echo $code."<hr>"; } } /*definition of functions to be used*/ function papAffiliateLogin(){ try { include_once API_FILE; $session = new Pap_Api_Session(URL_TO_PAP."/scripts/server.php"); if(!$session->login(AFFILIATE_USERNAME, AFFILIATE_PASSWORD, Gpf_Api_Session::AFFILIATE)) { //change it here for affiliate username and password die("Cannot login. Message: ".$session->getMessage()); return; } return $session; } catch (Exception $e){ die('Error: '.$e->getMessage()); return; } } function getBannerCodes($session,$htmlSpecialChars=NULL){ //---------------------------------------------- // get recordset with list of banners $request = new Gpf_Rpc_Gridrequest("Pap_Affiliates_Promo_BannersGrid","getRows",$session); // sets limit to 30 rows, offset to 0 (first row starts) $request->setLimit(0, 30); // Filter particular banner type(s); A = link banner, E = promo email, F = flash, H = HTML, I = image, V = Simple PDF, T = Text-Link //$request->addFilter('rtype',Gpf_Data_Filter::EQUALS,'E'); //$request->addFilter('id',Gpf_Data_Filter::EQUALS,'11110001'); // use this for filtering exact banner ID // send request try { $request->sendNow(); } catch(Exception $e) { die("API call error: ".$e->getMessage()); } // request was successful, get the grid result $grid = $request->getGrid(); $totalRecords = $grid->getTotalCount(); // get recordset from the grid $recordset = $grid->getRecordset(); if ($totalRecords>0){ $bannerCodes = array(); // iterate through the records foreach($recordset as $rec) { if(isset($htmlSpecialChars) && $htmlSpecialChars == 'Y'){ $bannerCodes[] = htmlspecialchars($rec->get('bannercode')); } else { $bannerCodes[] = $rec->get('bannercode'); } } //---------------------------------------------- // in case there are more than 30 records in total, // we should load and display the rest of the records // via the cycle below $maxRecords = $recordset->getSize(); if ($maxRecords>0){ $cycles = ceil($totalRecords / $maxRecords); for($i=1; $i<$cycles; $i++) { // now get next 30 records $request->setLimit($i * $maxRecords, $maxRecords); $request->sendNow(); $recordset = $request->getGrid()->getRecordset(); // iterate through the records foreach($recordset as $rec) { if(isset($htmlSpecialChars) && $htmlSpecialChars == 'Y'){ $bannerCodes[] = htmlspecialchars($rec->get('bannercode')); } else { $bannerCodes[] = $rec->get('bannercode'); } } } } return $bannerCodes; } } ?>