Git Product home page Git Product logo

google-api-php-client's Introduction

Google APIs Client Library for PHP
=====================================

== Description
The Google API Client Library enables you to work with Google APIs such as Google+, Drive, Tasks, or Latitude on your server.

Requirements:
  PHP 5.2.x or higher [http://www.php.net/]
  PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
  PHP JSON extension [http://php.net/manual/en/book.json.php]

Project page:
  http://code.google.com/p/google-api-php-client

OAuth 2 instructions:
  http://code.google.com/p/google-api-php-client/wiki/OAuth2

Report a defect or feature request here:
  http://code.google.com/p/google-api-php-client/issues/entry

Subscribe to project updates in your feed reader:
  http://code.google.com/feeds/p/google-api-php-client/updates/basic

Supported sample applications:
  http://code.google.com/p/google-api-php-client/wiki/Samples

== Basic Example
  <?php
  require_once 'path/to/src/Google_Client.php';
  require_once 'path/to/src/contrib/apiBooksService.php';

  $client = new Google_Client();
  $service = new Google_BooksService($client);

  $optParams = array('filter' => 'free-ebooks');
  $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);

  foreach ($results['items'] as $item) {
    print($item['volumeInfo']['title'] . '<br>');
  }

google-api-php-client's People

Contributors

chirags avatar davidtorres avatar silvolu avatar

google-api-php-client's Issues

Warning Message

I get the following error:

Warning: strlen() expects parameter 1 to be string, array given in 
/var/www/library/google/src/io/apiCurlIO.php on line 91


Original issue reported on code.google.com by [email protected] on 21 Jul 2011 at 10:35

Exemple file : filter_var level

What steps will reproduce the problem?
1. Use the bundled exemple for G+ API

What is the expected output? What do you see instead?
Expected extract from my own activities should start with : "grâce à la 
pub[...]"
Current result : "grce à la pub[...]"

What version of the product are you using? On what operating system?
Experienced with different environnements :
- debian + php5.3.6-6
- mac os X + php5.3.6

Please provide any additional information below.
filter_var flag level does not allow display of special chars. Here is a patch 
for this.

Original issue reported on code.google.com by [email protected] on 8 Oct 2011 at 3:44

apiOAuth2 checks for refresh_token but doesn't set access_type to offline in createAuthUrl

What steps will reproduce the problem?
1. Set up apiClient using class in apiOAuth as auth class in config
2. Run authentication with redirect set to authorization method.
3. Upon receiving authorization code the authenticate method will try to make 
the exchange for an access token.
4. Because the access_type is not set, no refresh_token is sent back causing a 
validation error on setAccessToken()

What is the expected output? What do you see instead?
After creating the Auth url (auth/apiOAuth2 #91) for the authorization grant 
and getting back the parameter "code" the authenticate method should request an 
access token. When successful the setAccessToken in apiOAuth2 class should run 
correctly but throws apiAuthException("Invalid token format") instead.

What version of the product are you using? On what operating system?
google-api-php-client 0.47 
PHP 5.3.6
Fedora 2.6.35.14-96.fc14.i686.PAE

Please provide any additional information below.
According to the documents 
(http://code.google.com/p/google-api-php-client/wiki/OAuth2), refresh_token 
only returns when when access_type is set to offline on authorization. But the 
setAccessToken method in apiOAuth2 throws an exception when refresh_token is 
not set (auth/apiOAuth2 #107). 

Original issue reported on code.google.com by [email protected] on 10 Dec 2011 at 1:40

Authorisation google API spreadsheets using PHP.

What steps will reproduce the problem?
1.I need to set up authorisation to pass data to a google docs spreadsheet. 
2.I have all the code completed and working with simple username and password 
authorisation to my personal gmail. When I bring it over to the internal google 
hosting I need further authorisation. 
3.what steps do I need to take to get my php code authorised? 


What is the expected output? What do you see instead?
It is very important for this project that the user is not asked to input 
anything, so the script has to run in the background. So basally the php file 
is holding the varibles - then passing them to a spreadsheet for further 
evaluation.  

What version of the product are you using? On what operating system?
I have developed an elearning project with smartbuilder and php. This will be 
hosted on the google server for internal use only. 

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Sep 2011 at 4:29

ApiPlusService.php file MISSING in ZIP!!

What steps will reproduce the problem?
1.When I try to load the new google plus started project


What is the expected output? What do you see instead?
Warning: require_once(google-api-php-client/src/contrib/apiPlusService.php) 
[function.require-once]: failed to open stream: No such file or directory

What version of the product are you using? On what operating system?
Windows, Chrome

Please provide any additional information below.
The file is missing in the NEW Google Plus API Starter Package

Original issue reported on code.google.com by [email protected] on 15 Sep 2011 at 9:56

apiTasksService.php doesn't exist

https://code.google.com/apis/tasks/v1/using.html#setup mentions that it should 
contain src/contrib/apiTasksService.php to use the Tasks API - however, it's 
not there.
Can you please add it to the svn?

Thanks,
Dennis

Original issue reported on code.google.com by [email protected] on 12 May 2011 at 1:04

PHP Urlshortener Form fail

When you use the PHP example of the Urlshortener api in the Google Api PHP 
Client 0.4.1 (/google-api-php-client/examples/urlshortener), in the index.php 
file, when you are already log in, the form where you put the url to sort it 
use a GET method (line 67) but the lines 49 and 52 it search for an POST 
variable

Original issue reported on code.google.com by [email protected] on 12 Sep 2011 at 8:36

Generator cannot handle . characters in parameter names

Search API for shopping has parameters like 'debug.enabled', which do not make 
valid PHP function arguments.

To reproduce, look at the output of generation with the arguments 'shopping' 
'v1'.

The generated file has syntax errors.

Original issue reported on code.google.com by [email protected] on 14 Jan 2011 at 11:07

Error when granularity="best" in Latitude service

What steps will reproduce the problem?
1. Create a script with this content :

<?php

    require_once "../../src/apiClient.php";
    require_once "../../src/contrib/apiLatitudeService.php";

    require_once "includes/header.php";

    $apiClient = new apiClient();
    $lat = new apiLatitudeService($apiClient);

    if (isset($_SESSION['auth_token'])) {
      $apiClient->setAccessToken($_SESSION['auth_token']);
    } else {
      $_SESSION['auth_token'] = $apiClient->authenticate();
    }

    $latitude1 = $lat->getCurrentLocation('city');

    echo "<pre>";
    print_r($latitude1);
    echo "</pre>";

    $latitude2 = $lat->getCurrentLocation('best');

    echo "<pre>";
    print_r($latitude2);
    echo "</pre>";

?>

2. Execute the script and look the result


What is the expected output? What do you see instead?
The result to the line "$latitude1 = $lat->getCurrentLocation('city');" works, 
the position is returned, but
the line "$latitude2 = $lat->getCurrentLocation('best');" return an error :
Fatal error: Uncaught exception 'apiServiceException' with message 'Error 
calling 
https://www.googleapis.com/latitude/v1/currentLocation?granularity=best&alt=json
: (401) Invalid Credentials' in 
/home/www/9d39bf010a3c15d51e47350ba58958ce/web/src/io/apiREST.php:85 Stack 
trace: #0 
/home/www/9d39bf010a3c15d51e47350ba58958ce/web/src/service/apiServiceResource.ph
p(101): apiREST::execute(Object(apiServiceRequest)) #1 
/home/www/9d39bf010a3c15d51e47350ba58958ce/web/src/contrib/apiLatitudeService.ph
p(115): apiServiceResource->__call('get', Array) #2 
/home/www/9d39bf010a3c15d51e47350ba58958ce/web/examples/latitude/getLatitude.php
(30): apiLatitudeService->getCurrentLocation('best') #3 {main} thrown in 
/home/www/9d39bf010a3c15d51e47350ba58958ce/web/src/io/apiREST.php on line 85

What version of the product are you using? On what operating system?
Library version: google-api-php-client 0.2
OS: Linux


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 21 Jan 2011 at 5:51

400 Bad Request

When i ran the code 

https://accounts.google.com/o/oauth2/auth?
  client_id=21302922996.apps.googleusercontent.com&
  redirect_uri=https://www.example.com/back&
  scope=https://www.google.com/m8/feeds/&
  response_type=token

from my website, it gave me a 404 error



Original issue reported on code.google.com by [email protected] on 16 Sep 2011 at 4:12

Latitude Error Gives 401 Invalid Credential with anything

Latiutude API gives 401 When trying to get current location or anything


What steps will reproduce the problem?
1.I'm authorized with oAuth normally for ( granularity=best & locaiton=current)
2.I'm redirected back to my site now when I try to fetch the currentlocation I 
get 401 Invalid credentials


What is the expected output? What do you see instead?
- the expected output is to get the location not 401 Error


What version of the product are you using? On what operating system?

v1 with any of the Client Libs provided by google 

Please provide any additional information below.

This is my Code both give the same error


<-------------- CODE 1 --------------->


<?php 

ini_set("display_errors",1);
error_reporting(E_ALL);
session_start(); 
// set_include_path('/home/library/'.get_include_path());
require_once 'Zend/Oauth/Consumer.php'; 

$oauthOptions = array(
    'requestScheme'        => Zend_Oauth::REQUEST_SCHEME_HEADER,
    'version'              => '1.0',
    'consumerKey'          => '################My Key###########',
    'consumerSecret'       => '################My Secret########',
    'signatureMethod'      => 'HMAC-SHA1',
    'requestTokenUrl'      => 'https://www.google.com/accounts/OAuthGetRequestToken',
    'userAuthorizationUrl' => 'https://www.google.com/latitude/apps/OAuthAuthorizeToken',
    'accessTokenUrl'       => 'https://www.google.com/accounts/OAuthGetAccessToken',
    'callbackUrl'          => 'http://web2era.com/googleapi/examples/',
);
$consumer = new Zend_Oauth_Consumer($oauthOptions); 
if (!isset($_SESSION['ACCESS_TOKEN_GOOGLE'])) { 
    if (!empty($_GET)) { 
        $token = $consumer->getAccessToken($_GET, unserialize($_SESSION['REQUEST_TOKEN_GOOGLE'])); 
        $_SESSION['ACCESS_TOKEN_GOOGLE'] = serialize($token); 
    } else { 
        $token = $consumer->getRequestToken(array('scope'=>'https://www.googleapis.com/auth/latitude')); 
        $_SESSION['REQUEST_TOKEN_GOOGLE'] = serialize($token); 
        $customparams = array('domain' => 'web2era.com', 'granularity' => 'best', 'location' => 'current');
        $consumer->redirect($customparams ); 
        exit; 
    } 
} else { 
    $token = unserialize($_SESSION['ACCESS_TOKEN_GOOGLE']); 
    //$_SESSION['ACCESS_TOKEN_GOOGLE'] = null; // do not use, we want to keep the access token
} 
$client = $token->getHttpClient($oauthOptions); 
// I Use this
$client->setUri('https://www.googleapis.com/latitude/v1/currentLocation?granular
ity=best'); 
// Other times I use this
$client->setUri('https://www.googleapis.com/latitude/v1/currentLocation'); 
$client->addParameterGet("granularity","best");

$client->setMethod(Zend_Http_Client::GET); 


$response = $client->request(); 
$body = $response->getBody();
header('Content-Type: ' . $response->getHeader('Content-Type')); 
echo $response->getBody(); 

<-------------- Another Code That doesn't work tooo ------------->

session_start();
ini_set("display_errors","on");
require_once '../src/apiClient.php';
require_once '../src/contrib/apiBuzzService.php';
require_once '../src/contrib/apiLatitudeService.php';
global $apiConfig;
$apiConfig['oauth2_client_id'] = '######### Client ID ##########';
$apiConfig['oauth2_client_secret'] = '####### Secret #######';

// The oauth2_redirect_uri is typically the path to where you host this PHP 
file.
$apiConfig['oauth2_redirect_uri'] = 'http://web2era.com/googleapi/examples';
$apiconfig['authClass'] = 'apiOAuth2';

$apiClient = new apiClient();

$latitude = new apiLatitudeService($apiClient);

$apiClient->discover("latitude", "v1");

$latitude->setVersion("v1");


if (isset($_SESSION['oauth_access_token'])) {
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
  $token = $apiClient->authenticate();
  $_SESSION['oauth_access_token'] = $token;
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
}


    $latitude1 = $latitude->getCurrentLocation('city');

    echo "<pre>";
    print_r($latitude1);
    echo "</pre>";

    echo $latitude1;

////
////  Notice the (almost) same code Works perfectly for Buzz
////


Original issue reported on code.google.com by shehabic on 18 Jun 2011 at 1:37

  • Merged into: #5

Issue in Adsense Service Library

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
Fatal error: Uncaught exception 'apiException' with message 'Unknown function: 
adsense->reports->generate()'

What version of the product are you using? On what operating system?
PHP 5.3.4, PHP 5.2.17

Please provide any additional information below.
The issue seems to be in apiAdSenseService.php line 235 where report resource 
is initialized. The json_decode returns NULL.

Original issue reported on code.google.com by [email protected] on 29 Nov 2011 at 8:41

Certificate error?

What steps will reproduce the problem?
1. I made my first G+ project: create client_id, then starting to connect with 
Google Api PHP Client and Starter package.
2. Clicked "Connect Me!" Then "Allow Access"
3. I retured to my landing page, with error msg (see later). I got "code" 
params in url.

What is the expected output? What do you see instead?
Error msg was: "SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify 
failed"

What version of the product are you using? On what operating system?
I am using "google-api-php-client" and "google-plus-php-starter" on local wamp 
server.

Please provide any additional information below.
"Fatal error: Uncaught exception 'apiIOException' with message ' in 
C:\wamp\www\google-plus-php-starter\google-api-php-client\src\io\apiCurlIO.php 
on line 122" 

Br,
kP.

Original issue reported on code.google.com by [email protected] on 15 Sep 2011 at 9:29

Add feature to specify timeouts

When using the PHP library we should be able to set curl timeouts which are 
expressed in the apiCurlIO class using CURLOPT_CONNECTTIMEOUT and 
CURLOPT_TIMEOUT.


Original issue reported on code.google.com by [email protected] on 25 Oct 2011 at 9:34

Create a config parameter for sending the userIp parameter.

We can limit the number of requests per second per user for an API  to prevent 
individual users from eating up API quota.

Documentation. https://code.google.com/apis/console-help/#PreventMonopolizing

Simply need to add the userIp query parameter.

Original issue reported on code.google.com by [email protected] on 23 Sep 2011 at 1:33

People->get does not support parameters (fields)

What steps will reproduce the problem?
1. If you try to call yourPlusInstance->people->get(ID) it doesn't support 
parameters.
2. The API though support the parameter 'fields' to indicate whether you want 
special parameters or not.

What is the expected output? What do you see instead?
I should be able to use the API completely but instead, I can just retrieve the 
'whole' profile of a person, but not concrete fields (as objectType, which is 
not returned by default).

What version of the product are you using? On what operating system?
0.4.7. The OS is Linux but the problem is with the code.

Please provide any additional information below.
The problem is found on 
/.../google-api-php-client/src/contrib/apiPlusService.php, on line 202 the 
function is implemented and it DOES NOT support any extra parameter. If I 
change the code there and add mor parameters to $params they will just work as 
expected.

Original issue reported on code.google.com by [email protected] on 15 Dec 2011 at 12:09

Wrong encoding for Hebrew posts stream on Chromium (v 12 on Ubuntu)

What steps will reproduce the problem?
1. Run the sample : http://code.google.com/p/google-api-php-client/ on a 
Chromium browser
2. Hebrew post stream is displayed in wrong encoding (unreadable)
3. Switching to Firefox 6, everything displays fine. (without changing the code)

What is the expected output? What do you see instead?
Hebrew text in the stream of posts

What version of the product are you using? On what operating system?
Chromium 12.0.742.112 (90304) Ubuntu 11.04 64bit

Please provide any additional information below.


Original issue reported on code.google.com by nadavkav on 29 Sep 2011 at 9:15

Support for revoking a refresh_token

It would be nice if the library had a method for programmatically revoking the 
refresh_token.  It's not terribly difficult to do, but it seems like something 
that should be handled by the library...

This is how we are doing it currently:

$ch = curl_init ('https://accounts.google.com/o/oauth2/revoke');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('token' => $token));
curl_exec($ch);

Original issue reported on code.google.com by [email protected] on 14 Dec 2011 at 7:02

Expand $ref in a schema to extend the parent class.

The latitude API has the following in the discovery document:
  "schemas": {
     "LatitudeCurrentlocationResourceJson": {
        "$ref": "Location"
     },

When the service class is generated with this, 
LatitudeCurrentlocationResourceJson should extend the Location class.


Original issue reported on code.google.com by [email protected] on 15 Aug 2011 at 10:40

AdSense Reporting class unable to properly initialize

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
Fatal error: Uncaught exception 'apiException' with message 'Unknown function: 
adsense->reports->generate()' in apiServiceResource.php


What version of the product are you using? On what operating system?
PHP 5.3.8

Please provide any additional information below.
Related to this issue:  
http://code.google.com/p/google-api-php-client/issues/detail?id=42

The fix in the source did not fix it... the underlying problem is the JSON 
encoded method definition cannot be decoded.  If you take the JSON code (from 
trunk), you can see PHP is unable to decode the JSON...


print_r (json_decode('{"methods": {"generate": {"scopes": 
["https://www.googleapis.com/auth/adsense", 
"https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"sort": 
{"pattern": "(\\+|-)?[a-zA-Z_]+", "repeated": true, "type": "string", 
"location": "query"}, "startDate": {"pattern": "\\d{4}-\\d{2}-\\d{2}", 
"required": true, "type": "string", "location": "query"}, "endDate": 
{"pattern": "\\d{4}-\\d{2}-\\d{2}", "required": true, "type": "string", 
"location": "query"}, "locale": {"pattern": "[a-zA-Z_]+", "type": "string", 
"location": "query"}, "metric": {"pattern": "[a-zA-Z_]+", "repeated": true, 
"type": "string", "location": "query"}, "maxResults": {"format": "int32", 
"maximum": "50000", "minimum": "0", "location": "query", "type": "integer"}, 
"filter": {"pattern": "[a-zA-Z_]+(==|=@).+", "repeated": true, "type": 
"string", "location": "query"}, "currency": {"pattern": "[a-zA-Z]+", "type": 
"string", "location": "query"}, "startIndex": {"format": "int32", "maximum": 
"5000", "minimum": "0", "location": "query", "type": "integer"}, "dimension": 
{"pattern": "[a-zA-Z_]+", "repeated": true, "type": "string", "location": 
"query"}}, "id": "adsense.reports.generate", "httpMethod": "GET", "path": 
"reports", "response": {"$ref": "AdsenseReportsGenerateResponse"}}}}', true));
json_last_error();

It gives a json last error of 4, which is JSON_ERROR_SYNTAX.

Original issue reported on code.google.com by [email protected] on 14 Dec 2011 at 11:38

SSL issue on G+ example code on local host

What steps will reproduce the problem?
1. i'm using this code: 
https://google-plus-php-starter.googlecode.com/svn/trunk/index.php
2. i've inserted my oauth ids, url, secret
3. i'm getting error

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

expected ouput: anything else than an error. to connect, so i can work around 
further, to display something from my profile

i receive the folowing error:

Fatal error: Uncaught exception 'apiIOException' with message 'HTTP Error: (60) 
SSL certificate problem, verify that the CA cert is OK. Details: 
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify 
failed' in 
C:\wamp\www\googleplus\google-api-php-client\src\io\apiCurlIO.php:120 Stack 
trace: #0 
C:\wamp\www\googleplus\google-api-php-client\src\auth\apiOAuth2.php(72): 
apiCurlIO->makeRequest(Object(apiHttpRequest)) #1 
C:\wamp\www\googleplus\google-api-php-client\src\apiClient.php(130): 
apiOAuth2->authenticate(Array) #2 C:\wamp\www\googleplus\index.php(46): 
apiClient->authenticate() #3 {main} thrown in 
C:\wamp\www\googleplus\google-api-php-client\src\io\apiCurlIO.php on line 120


What version of the product are you using? On what operating system?

api php client 0.4.4; win xp,  wamp, php 5.3.0, curl_extension enabled,

Please provide any additional information below.

i'm new to this kind of application. 

Original issue reported on code.google.com by [email protected] on 16 Sep 2011 at 12:40

Add support for the .localhost TLD

Hi,

I know it's probably not the right place to submit this issue but I've found 
nothing else better...

When creating a client ID in the Google API Console 
(https://code.google.com/apis/console/), you can't submit a "Redirect URIs" 
like this one : http://googleplusapi.localhost
Though, http://localhost is considered as a valid URI. So I wondered if there 
was any particular reason to this behavior ?

Original issue reported on code.google.com by [email protected] on 9 Oct 2011 at 12:19

Improvement > Countable interface in apiModel class

The implementation of the Countable interface in apiModel class should be done 
this way (based on r240) :

  public function count()
  {
    if (null === $this->items || 0 == ($nbItems = count($this->items)))
    {
      return 1;
    }

    return $nbItems;
  }


I guess the apiModel class should be made abstract as well !

Original issue reported on code.google.com by [email protected] on 10 Oct 2011 at 11:11

Little bug into Tasks example into 'name' property

While testing the given Tasks API example, I found a little bug into 
examples/tasks/index.php line 59

The 'name' property doesn't exist.
print "<h3>{$list['name']}</h3>";

'title' property should be used instead
print "<h3>{$list['title']}</h3>";


Great PHP CL! thanks to all of you guys.

Hugo

Original issue reported on code.google.com by [email protected] on 6 Nov 2011 at 6:13

Undefined index: methods google-api-client-php\service\apiServiceResource.php

What steps will reproduce the problem?
1. Initialize and create a valid apiClient
2. Initialize an apiAnalyticsService object with the client object
3. The notice in the subject should be present


What is the expected output? What do you see instead?
I expect an apiAnalyticsService object with a subset of different objects, 
ManagementWebpropertiesServiceResource, ManagementSegmentsServiceResource, etc. 
 Instead, and I believe this is due to the undefined index error, none of these 
objects are present

What version of the product are you using? On what operating system?
r284

Please provide any additional information below.
I believe the bug is in apiAnalyticsService.php in the constructor.  A long 
json object is sent to the ManagmentServiceResource constructor as the 
"resource".  The constructor expects a 'method' index, but instead it receives 
an object with a number of resources with their own 'method' indexes, which I 
don't think it handles properly.

Original issue reported on code.google.com by davidcroda on 14 Dec 2011 at 3:44

include path apiClient.php

in apiClient.php : 

set_include_path("$cwd" . PATH_SEPARATOR . ":" . get_include_path());

which breaks include_path because of  PATH_SEPARATOR . ":" 

The good instruction should be : 

set_include_path("$cwd" . PATH_SEPARATOR . get_include_path());

Original issue reported on code.google.com by [email protected] on 5 Nov 2011 at 10:15

Internal error (500) while trying to access https://www.googleapis.com/userinfo/email

What steps will reproduce the problem?
1. I have written the following "index.php" in order to get the user email:

session_start();

require_once "../src/apiClient.php";
require_once "../src/contrib/apiEasyhybridService.php";

$apiClient = new apiClient();
$user = new apiEasyhybridService($apiClient);

if (isset($_SESSION['oauth_access_token'])) {
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
  $token = $apiClient->authenticate();
  $_SESSION['oauth_access_token'] = $token;
}

$email = $user->getUseremail();
echo "<pre>Email:\n" . print_r($email, true) . "</pre>";

2. I have run the page in a browser.

What is the expected output? What do you see instead?
Expected:
1) Login to google account request
2) Allow the application to access the user email
3) Print the user email

Instead:
1) Login to google account request
2) Allow the application to access the user email
3) Print the following fatal error : 

Fatal error: 
Uncaught exception 'apiServiceException' with message 'Error calling GET 
https://www.googleapis.com/userinfo/email?alt=json: (500) Internal Error' in 
/path/src/io/apiREST.php:85 Stack trace: #0 
/path/src/service/apiServiceResource.php(101): 
apiREST::execute(Object(apiServiceRequest)) #1 
/path/src/contrib/apiEasyhybridService.php(51): 
apiServiceResource->__call('get', Array) #2 /path/examples/index.php(84): 
apiEasyhybridService->getUseremail() #3 {main} thrown in 
/path/src/io/apiREST.php on line 85

What version of the product are you using? On what operating system?

I use the 0.2 version on a LAMP server.

Please provide any additional information below.

I have been able to reproduce this behavior on the google Oauth playground
(http://googlecodesamples.com/oauth_playground/index.php). On the sixtieth 
step, if you try to access to https://www.googleapis.com/userinfo/email with 
"Stick oauth_* params in: Authorization header" everything works fine and it 
returns the user email whereas is you try to access it with "Stick oauth_* 
params in: URL as params" it returns an internal error.

So my opinion was that the parameter "?alt=json" was not properly handled and 
it was the reason why the server was returning this internal error. So I 
managed to remove this parameter from the URL just to figure out if the access 
request was working but I got the same result...

I would be very grateful if you could find a workaround or explain me what I am 
doing wrong .

Thanks for your time.

Original issue reported on code.google.com by [email protected] on 24 Nov 2010 at 9:59

OAuth2 approval_prompt=auto

According to this blog entry 
(http://googlecode.blogspot.com/2011/10/upcoming-changes-to-oauth-20-endpoint.ht
ml), if you do not specify a value for approval_prompt or if you set it to 
"auto", the service should not ask the user to approve more than once.

Using the PHP client, doing so gives me:
Error fetching OAuth2 access token, message: 'redirect_uri_mismatch'


Original issue reported on code.google.com by [email protected] on 12 Dec 2011 at 11:59

UserInfo wrapper

The documentation describes a userinfo.profile call 
(http://code.google.com/apis/accounts/docs/OAuth2Login.html#userinfocall) 
without using Google+.

I can't find in this PHP wrapper how to make that call.


Original issue reported on code.google.com by [email protected] on 30 Nov 2011 at 12:32

PHP Sample for Google Affiliate Network

Would like to see sample code for the following:
PHP Sample for Google Affiliate Network

Which Google API and version (e.g. Google Calendar Data API version 2)?
Google Affiliate Network API v1beta1, Events and Order Detail

What format (e.g. JSON, Atom)?
JSON

What Authentation (e.g. OAuth, OAuth 2, ClientLogin)?
Simple API Access (using API key for server apps (with IP locking))

External references, such as API reference guide?
http://code.google.com/apis/gan/index.html
http://code.google.com/apis/gan/overview.html

Please provide any additional information below.
Looking to get Events and Order Detail from the Google Affiliate Network API 
using Simple API Access (no OAuth) via PHP.

Original issue reported on code.google.com by [email protected] on 16 Dec 2011 at 2:55

programming error in php buzz example

What steps will reproduce the problem?

Just try to run the buzz example. 
.../google-api-php-client/examples/buzz/index.php
Then "Get the public stram"

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

PHP-Error message in getPublicStream.php line 33

What version of the product are you using? On what operating system?

latest version: google-api-php-client-0.4.4.tar.gz.

Please provide any additional information below.

line 33 should be:

$apiClient->setApplicationName(

instead of 

$client->setApplicationName(

Original issue reported on code.google.com by [email protected] on 16 Sep 2011 at 9:24

Task API doesn't get lists with Google Apps domains

Hello,

I have 4 task lists on my flx.me google apps domain but I can't retrieve the 
lists. It only receives the list "me's list" (which reflect's the username 
"me"). However, when using a task list on gmail, it works fine and retrieves 
all lists.

Code used:

<?php
//load libs
require_once "include/google-api-php-client/src/apiClient.php";
require_once "include/google-api-php-client/src/contrib/apiTasksService.php";

//load api
$apiClient = new apiClient();
$service = new apiTasksService($apiClient);

//authenticate
if (isset($_SESSION['oauth_access_token'])) {
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
  $token = $apiClient->authenticate();
  $_SESSION['oauth_access_token'] = $token;
}

//get list
$taskLists = $service->listTasklists();

foreach ($taskLists['items'] as $taskList) {
  echo $taskList['title'] . " - " . $taskList['id'] . "<br />";
}
?>

How can I fix this?

Thanks,
Dennis

Original issue reported on code.google.com by [email protected] on 13 May 2011 at 10:25

Problem with variable in buzz example

What steps will reproduce the problem?
1. Go to  http://localhost/google-api-php-client/examples/buzz
2. Click on the Get the consumption stream or Get the public stream links

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

The expected output is the consumption stream or the public stream instead 
there is the following error:

Notice: Undefined variable: client in 
/var/www/google-api-php-client/examples/buzz/getConsumptionStream.php on line 
33 Call Stack: 0.0003 629104 1. {main}() 
/var/www/google-api-php-client/examples/buzz/getConsumptionStream.php:0 Fatal 
error: Call to a member function setApplicationName() on a non-object in 
/var/www/google-api-php-client/examples/buzz/getConsumptionStream.php on line 
33 Call Stack: 0.0003 629104 1. {main}() 
/var/www/google-api-php-client/examples/buzz/getConsumptionStream.php:0

What version of the product are you using? On what operating system?

google-api-php-client-0.4.4.tar.gz

Ubuntu 10.04


Please provide any additional information below.

I change the name of the variable on line 33 from $client to $apiClient that is 
what is defined on line 32 and everything works.

Original issue reported on code.google.com by [email protected] on 15 Sep 2011 at 8:29

Distribute the API via PEAR

The easiest vary and the most commen way is to distribute a package like this 
via PEAR. 

This would be a very nice feature.

Original issue reported on code.google.com by [email protected] on 9 Sep 2011 at 6:44

Move core components of the library into the 'base' folder.

The library is currently broken into the following structure:

google-api-php-client
 - test
 - examples
 - src
    -- auth
    -- service
    -- io
    -- auth
    -- cache
    -- services
    -- external
    -- apiClient.php
    -- config.php


Here's the proposed structure. This has a more obvious call-to-action when 
developers first unzip the client library. They will first see the php files 
they need to configure, and the apiClient.

google-api-php-client:
 - test
 - examples
 - config.php
 - apiClient.php
 - base
    -- auth
    -- service
    -- io
    -- auth
    -- cache
    -- services
    -- external

Original issue reported on code.google.com by [email protected] on 17 Aug 2011 at 1:46

"use_objects = true" results in only the outermost element to be returned as an object

What steps will reproduce the problem?
1. Set 'use_objects' => true in your config
2. Call e.g. $query = $plus->comments->listComments("INSERT_ACTIVITY_ID")

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

$query is an Object of the type CommentFeed, that's OK. However, what I expect 
is that $query->items is an array of Comment objects. Instead, it is an array 
of arrays. So after all, only the main element is returned as an object, all 
children stay unchanged (although corresponding objects do exist!)

What version of the product are you using? On what operating system?

Version 0.4.5

Please provide any additional information below.

One possible solution for this issue which comes into my mind is overriding the 
apiModel constructor in the classes which may have children of another object 
type and convert them to objects afterwards.

Here is an example based on the CommentFeed object:

class CommentFeed extends apiModel {

  ...

  public function __construct() {
    parent::__construct(func_get_arg(0));

    foreach ($this->items as $key => $item) {
      $this->items[$key] = new Comment($item);
    }
  }

  ...
}

It's probably not best-practice, but it works. If the same change would be made 
to the other objects as well, we would have fully object-oriented results when 
'use_objects' is set to true.

Original issue reported on code.google.com by [email protected] on 5 Oct 2011 at 1:27

Parameter "state" can not be specified on authorization

Parameter "state" can not be specified on authorization:
/* File apiOAuth2.php */
  public function createAuthUrl($service) {
    $params = array(
        'response_type=code',
        'redirect_uri=' . urlencode($this->RedirectUri),
        'client_id=' . urlencode($this->ClientId),
        'scope=' . urlencode($service['scope'])
    );
    $params = implode('&', $params);
    return self::OAUTH2_AUTH_URL . "?$params";
  }

This parameter is missed in this function.


Original issue reported on code.google.com by [email protected] on 10 Sep 2011 at 7:58

Patch for /trunk/examples/latitude/index.php

Only start to make API requests if a token exists.  If no token exists then the 
only thing we should be doing is creating the authorization URL and printing 
the Connect Me! link.

Otherwise, an error will be thrown when it tries to refresh a token that 
doesn't exist.

Original issue reported on code.google.com by [email protected] on 17 Aug 2011 at 11:12

Attachments:

Having to Reauthorize my site EVERY time

Okay, I used the sample code to dump my profile. But every time I have a 
different page try and loud my profile I have to reauthorize it to use my 
google account.  I figured this would be a one time auth process.  My code is 
literally the same on each page.  Pages being index.php or profile.php.  The 
Domain is the same every time. 

So in summary: if I load http://www.mydomain.com it takes me to that connect me 
button and then we I go to http://wwww.mydomain.com/profile.php I get sent to 
the connect me button again.  Should that be happening?

  $authUrl = $client->createAuthUrl();
  print "<a class='login' href='$authUrl'>Connect Me!</a>"; 


Original issue reported on code.google.com by [email protected] on 9 Oct 2011 at 8:39

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.