1
votes

I have enabled billing and have 10$ balance in my project, I have created Key for browser applications, with right referrer I have generate key , my code is given below

$api_key = 'My Key is Here';


$response = file_get_contents('https://www.googleapis.com/language/translate/v2?key='.$api_key.'&q=hello%20world&source=en&target=de');

//decode json to array
$json = json_decode($response);

//show the json array in a readable format
echo '<pre>';

//show array
print_r($json);

I am getting following errors

stdClass Object ( [error] => stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [domain] => usageLimits [reason] => accessNotConfigured [message] => Access Not Configured. Please use Google Developers Console to activate the API for your project. )

            )

        [code] => 403
        [message] => Access Not Configured. Please use Google Developers Console to activate the API for your project.
    )

)

Please would you help me to figure out, what i have missed or did wrong that i get above error.

Many Thanks

1

1 Answers

0
votes

Make sure you have enabled translate API in developer console. enter image description here