NAVNavbar
Logo
php python csharp java

Authentication

To authorize, use this code:

<?php
require('RestClient.php');
//You can download this file from here https://api.dataforseo.com/_examples/php/_php_RestClient.zip

try {
    //Instead of 'login' and 'password' use your credentials from https://my.dataforseo.com/#api_dashboard
    $client = new RestClient('https://api.dataforseo.com/', null, 'login', 'password');

    //do something

} catch (RestClientException $e) {
    echo "\n";
    print "HTTP code: {$e->getHttpCode()}\n";
    print "Error code: {$e->getCode()}\n";
    print "Message: {$e->getMessage()}\n";
    print  $e->getTraceAsString();
    echo "\n";
    exit();
}
?>

Instead of ‘login’ and ‘password’ use your credentials from https://my.dataforseo.com/#api_dashboard

Create an account with DataForSEO and then use the credentials from your account’s dashboard to access our APIs.

Note that DataForSEO is using the Basic Authentication, which makes it possible to use our APIs with almost every programming language.