View
 

PHP Wrapper and Examples

2Performant networks can be integrated in any web application.

This PHP wrapper provides a simple way of interacting with the API.

 

Get the API from Github

(git clone git://github.com/2performant/2Performant-php.git)

 

Examples:

 

require '2performant.php';

$session = new TPerformant("simple", array("user" => "user", "pass" => "pass"), 'http://api.yournetwork.com');

 

// or via Oauth

$consumer = new HTTP_OAuth_Consumer($APP_KEY, $APP_SECRET, $oauth_data['token'], $oauth_data['secret']);

$session = new Tperformant("oauth", $consumer, "http://api.yournetwork.com");

 

 

// Merchants: show own campaigns

print_r($session->campaigns_listforowner());

 

// Affiliates: show site with ID 1

print_r($session->site_show('1'));

 

// Merchants: create a Text Ad in the campaign with ID 2

$txtad = array("title" => "Title", "content" => "Content", "url" => "www.google.com", "help" => "Help and Suggestions");

print_r($session->txtad_create(2, $txtad));

 

// Affiliates: update a site

$site = $session->site_show('1');

$site->{'description'} = 'API update';

print_r($session->site_update('1', $site));

 

// Affiliates: delete a site

print_r($session->site_destroy('13'));