PHP code example of openx / ox3-php-api-client

1. Go to this page and download the library: Download openx/ox3-php-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

openx / ox3-php-api-client example snippets


  
$path1 = '/Users/.../ZendFramework-2.4.5/library/';
$path2 = '/Users/.../vendor/';  

set_
`
  
$path1 = '/Users/.../ZendFramework-1.12.13/library/';  

set_
injectablephp

// If using Zend Framework 1
Api_Client2.php';
// if using the composer autoloader with the namespaced client
'';  

// If using Zend Framework 1
$client = new OX3_API_Client($uri, $email, $password, $key, $secret, $realm); 
// if Using Zend Framework 2
$client = new OX3_API_Client2($uri, $email, $password, $key, $secret, $realm);
// if using the new class 
$client = new \OpenX\PlatformAPI\OXApiClient($uri, $email, $password, $key, $secret, $realm);
injectablephp
$result = $client->get('/"object_type"');  
// Example:
$result = $client->get('/account');  
injectablephp
$query = array("attribute"=>"value");  
$result = $client->get('/object_type', $query)  
// Example:
$query1 = array('name'=>'OpenX');  
result1 = $client->get('/account', $query1);  
// --> Returns the account(s) with the name OpenX  
injectablephp
$result = $client->get('/options/:field_options')  
// Example:
$content_types = $client->get('/options/content_type_options');
injectablephp
$query = array(  
'account_uid'=>"...",   
'currency'=>"...",   
.  
.  
.  
'timezone'=>"...");  
$result = $client->post('/:object_type/', $query);