User validation test

Headers are set up according to Authentification pre-requisite specifications.

This example allows you to verify the identity of your user within Adways.

No post parameters are necessary. The request will return the Adways user id, if he exists on the Adways platform.

    // Get cURL resource
    $curl = curl_init();

    // Server EndPoint
    $url = 'https://services.adways.com/identify';

    $method = 'POST';
    $headers = array();

    $options = array();
    $options[CURLOPT_RETURNTRANSFER] = 1;
    $options[CURLOPT_URL] = $url;
    $options[CURLOPT_SSL_VERIFYPEER] = false;
    $options[CURLOPT_POST] = 1;

    curl_setopt_array($curl, $options);

    // $access_token: your access token, from your platform
    // X-Token-Provider: to identify the source of the given token
    $headers[] = 'Authorization: Bearer ' . $access_token;
    $headers[] = 'X-Token-Provider: ' . $tokenProviderConstant;

    curl_setopt($curl,CURLOPT_HTTPHEADER, $headers);

    // Send the request & save response to $response
    $response = json_decode(curl_exec($curl), true);

    // Save Curl Info request
    $curlInfos = curl_getinfo($curl);

    // Close request to clear up some resources
    curl_close($curl);

    $adways_user_id = null;

    // User is identified, you get the Adways User id
    if($curlInfos['http_code'] == 200 && $response['success']) {
            $adways_user_id = $response['user_id'];
    }

For more information: API Identifier