/
PHP cURL

PHP cURL

Below is a simple cURL example that may be used in place of Zend_Http_Client. The resulting response will still need to be parsed and handled appropriately. Additional cURL options may be used and the Content-Length Header will need to be adjusted when making POST and PUT requests to the API.

Get Authorisation Code
<?php
 
// This example is specifically for the "tokenAuthorizationCode" method above
 
$request = curl_init($url);
curl_setopt($request, CURLOPT_USERPWD, $config['client_id'] . ":" . $config['client_secret']);
curl_setopt($request, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Content-Length: 0'));
curl_setopt($request, CURLOPT_HEADER, 1);
curl_setopt($request, CURLOPT_POST, 1);
curl_setopt($request, CURLOPT_TIMEOUT, 10);
curl_setopt($request, CURLOPT_RETURNTRANSFER, TRUE);
 
if (isset($config['cookies'])) {
    $cookieString = array();
    foreach ($config['cookies'] as $name => $value) {
        $cookieString[] = $name . '=' . $value;
    }
    curl_setopt($request, CURLOPT_COOKIE, implode(';', $cookieString));
}
 
$result = curl_exec($request);
curl_close($request);
 
// Parse $result HEADER to determine if the request is successful and json_decode() the $result BODY for content

Related content

PHP SDK example
PHP SDK example
More like this
API Quick Start Guide
API Quick Start Guide
More like this
Examples of Authorisation and use of the Actionstep API in the staging environment using Postman
Examples of Authorisation and use of the Actionstep API in the staging environment using Postman
More like this
Responses
Responses
Read with this
PHP Zend Framework
PHP Zend Framework
More like this
Requests
Requests
Read with this