skishore119 / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
0 stars 0 forks source link

Parse error: syntax error, unexpected T_CONST #387

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. RUN callback/index.php
2.
3.

What is the expected output? What do you see instead?

Parse error: syntax error, unexpected T_CONST in 
/home/dbookmrk/domains/dbookmarks.com/public_html/gocallback_91315/index.php on 
line 10

index.php code
error lines:
const CLIENT_ID = 'XXX';
const SERVICE_ACCOUNT_NAME = 'Google+ Domains API';
const KEY_FILE = 'XXX.p12';

<?php

    require_once 'src/Google_Client.php';
    require_once 'src/contrib/Google_PredictionService.php';

    // Set your client id, service account name, and the path to your private key.
    // For more information about obtaining these keys, visit:
    // https://developers.google.com/console/help/#service_accounts
    const CLIENT_ID = 'XXX';
    const SERVICE_ACCOUNT_NAME = 'Google+ Domains API';

    // Make sure you keep your key.p12 file in a secure location, and isn't
    // readable by others.
    const KEY_FILE = 'XXX.p12';

    $client = new Google_Client();
    $client->setApplicationName("XXX");

    // Set your cached access token. Remember to replace $_SESSION with a
    // real database or memcached.
    session_start();
    if (isset($_SESSION['token'])) {
     $client->setAccessToken($_SESSION['token']);
    }

    // Load the key in PKCS 12 format (you need to download this from the
    // Google API Console when the service account was created.
    $key = file_get_contents(KEY_FILE);
    $client->setAssertionCredentials(new Google_AssertionCredentials(
        SERVICE_ACCOUNT_NAME,
        array('https://www.googleapis.com/auth/prediction'),
        $key)
    );

    $client->setClientId(CLIENT_ID);
    $service = new Google_PredictionService($client);

    // Prediction logic:
    $id = 'sample.languageid';
    $predictionData = new Google_InputInput();
    $predictionData->setCsvInstance(array('Je suis fatigue'));

    $input = new Google_Input();
    $input->setInput($predictionData);

    $result = $service->hostedmodels->predict($id, $input);
    print '<h2>Prediction Result:</h2><pre>' . print_r($result, true) . '</pre>';

    // We're not done yet. Remember to update the cached access token.
    // Remember to replace $_SESSION with a real database or memcached.
    if ($client->getAccessToken()) {
      $_SESSION['token'] = $client->getAccessToken();
    }
?>

Original issue reported on code.google.com by noo...@gmail.com on 3 Sep 2013 at 11:13

GoogleCodeExporter commented 8 years ago
This issue tracker is now closing. Development on the Google PHP client library 
moved to GitHub with the release of the 1.0.0-alpha, and now the 1.0 branch has 
reached beta status there will be no further releases of the 0.6 branch of the 
library. 

Please take a look at the latest version on 
https://github.com/google/google-api-php-client

For information on migrating, please take a look at this guide: 
https://developers.google.com/api-client-library/php/guide/migration

For general library support please ask a question on StackOverflow: 
http://stackoverflow.com/questions/tagged/google-api-php-client

If you are looking for support with a specific API, please contact the team 
working with that API via StackOverflow or their preferred support mechanism. 

If your issue still exists with the new version of the library, please raise a 
bug in the GitHub issue tracker with a minimal code sample. 

Thanks!

Original comment by ianbar...@google.com on 22 Jan 2014 at 4:53