Help unable to understand Google Translate API v2 for PHP?

{---------------------Final Update-----------------} I will need the api for production soon someday, but for now I just wanted to get used to it. And I was using it for a one time deal to save time. (But I ended up using two full days...) Anyways I found gtranslate for this. So I will look at the actual api sometime in the future when it is further along. :D

Yay I found a work around.

{--------------------------------UPDATE-------------------------------------------}

Since my original post I've been able to get a little farther with the help of prodigitalson, and David Gillen but I'm still at a lost.

I was getting a mysterious SLL error so I read a bit online and it told me to make a cert. Anyways the result of that is I spent most of the morning in programming hell as I tried to compile from source opensll on windows which just didn't work. And so I gave up on that Idea and found a post that suggested using curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); line and that dealt with the issue, Now the error I'm getting is:

Fatal error: Uncaught exception 'apiAuthException' with message
'Couldn't fetch request token, http code: 400, response body: Invalid scope:
https://www.googleapis.com/auth/translate ' in 
C:\xampp\htdocs\translate\google-api-php-client2\src\auth\apiOAuth.php:191 
Stack trace: 
#0 
C:\xampp\htdocs\translate\google-api-php-client2\src\auth\apiOAuth.php(169):
apiOAuth->requestRequestToken('http://localhos...') 
#1 C:\xampp\htdocs\translate\google-api-php-client2\src\auth\apiOAuth.php(87): 
apiOAuth->obtainRequestToken('http://localhos...', '4d9609c2bc4ce') 
#2 C:\xampp\htdocs\translate\google-api-php-client2\src\apiClient.php(131): 
apiOAuth->authenticate(Object(apiFileCache), Object(apiCurlIO), Array) 
#3 C:\xampp\htdocs\translate\lang.php(20): apiClient->authenticate() 
#4 {main} thrown in C:\xampp\htdocs\translate\google-api-php-client2\src\auth\apiOAuth.php on line 191

I'm now using this code to which the commented lines to not affect the error message

<?php
//session_start();
//$_session['auth_token'] = 'AIzaSyAdPfnEsdsQQ6AxSn6K78LznZXHfHZIB3M';

require_once('/google-api-php-client2/src/apiClient.php');
require_once('/google-api-php-client2/src/contrib/apiTranslateService.php');

$apiClient = new apiClient();
$translate = new apiTranslateService($apiClient);

//If a oauth token was stored in the session, use that- and otherwise go through the oauth dance
if (isset($_SESSION['auth_token'])) {
$apiClient->setAccessToken($_SESSION['auth_token']);
}
else {
//In a real application this would be stored in a database, not in the session
$_SESSION['auth_token'] = $apiClient->authenticate();
}

//$translate->listTranslations('Hello to the world of space', 'fr', 'text', 'en');

{----------------------------------ORIGINAL POST BELOW--------------------------------}

This is my first time trying to use an API of any sort and it's more frustrating than anything.

I'm trying to get the Google Translate API working on PHP. Unfortunately the documentation isn't dummy proof so I'm lost.

I've read this document up and down and side to side :

I've downloaded the PHP API Client shown here

And I'm trying to use this script in particular:

I don't really understand how to implement OOP* so this is my downfall. The documentation states that I need to use my api key to use it but I haven't found where I need to put that in the php api client.

So far this is what I've attempted:

<?php
include('../google-api-php-client/src/apiClient.php');
include('../google-api-php-client/src/contrib/apiTranslateService.php');
$a = new apiTranslateService;
$a->listTranslateions('Hello to the world of space', 'fr', 'text', 'en');
?>

And this is my result

Catchable fatal error: 
Argument 1 passed to apiTranslateService::__construct() 
must be an instance of apiClient, none given, called in     
C:\xampp\htdocs\translate\lang.php on line 7 and defined in 
C:\xampp\htdocs\google-api-php-client\src\contrib\apiTranslateService.php on line 38  

*If you know of a good website link to teach me oop feel free to leave it with me.

Thank you all


ANSWERS:


You need to instantiate an api client first (the first file youre requiring)... for example:

$client = new apiClient();
// do your auth with the client here

$translateService = new apiTranslateService($client);

As far as authenticating check out: note the example uses the Buzz service whereas you will be using the translate service.



 MORE:


 ? Android google translate API
 ? How to pass Whole paragraph to Google Translate API v2?
 ? Transliteration from Hindi to English on Android without using Google API
 ? Offline language translator API for Android?
 ? Transliteration with Android
 ? Javascript / jQuery replace last word in input box in tamil language?
 ? How to use the file of UTF-8 format as a .srt file to show subtitle in mediaplayer?
 ? Querying and extracting a Unicode value from sqlite3 in Python
 ? Increase charset="utf-8" Font size in php/mysql site
 ? Tibetan and Devanagari ligatures not getting stacked properly using iText