API Example Advertiser Get Campaign

From InClickAdServer

Retrieving Existing Campaign Data

This API Service Request will retrieve the data of an existing campaign. This API Service Request is typically used to obtain the campaign specific data to view or edit. This is NOT the API Service Request for advertisement delivery.

The Code Example

Breaking Down the Code

This require references the local inClick Ad Server deployment configuration files allowing your code to utilize the pre-packaged API Objects as well as the bundled PHPOlait services.

These requires (includes) contain the API Objects and Classes needed for this API Service Request.

The $base_url is the URL to your inClick Ad Server deployment, the ad server root URL. For local host API usage, the constant of INCLICK_WEB_URL is defined in the globals.php file referenced earlier. Remote deployments, deployments where the ad server and API Request Location are not on the same server, would change this to the fully qualified URL to the ad server root directory.

The $service_key is one of the the api_service_keys values you created for your ad server. (more information)

The $user_id is the inClick Advertiser account number we will be working with for this API Service Request. For this example, we are working with the House Advertiser account, 1001.

The remaining two lines create an instance of the classes needed to retrieve the existing campaign data.

This line is the API Service Reqeust that sends the request for campaign data to your inClick Ad Server deployment for the defined campaign ID. If a failure occurs, the error code and corresponding error message are returned as objects:


On a successful retrieval, the object values can be found within the following object:


This section of code is provided to give you a visual confirmation of what occurred.

The following is an example campaign object, the result of "print_r($result->getReturnValue());"