sreejith12 / google-api-php-client

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

PHP example for Cloud Storage #354

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What is the expected output? What do you see instead?
I understand that the Prediction API is the closest example available for the 
Cloud Storage API as it provides a service account example.

Authenticating and displaying buckets/objects in then fairly easy but I do feel 
though that the documentation is lacking an example of how to 'download' a file 
that is in cloud storage to a local directory.

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

Please provide any additional information below.
There are examples in other languages that do similar things I would like to do 
below but I can't see equivalent functions in PHP for this

https://developers.google.com/storage/docs/json_api/v1/objects/get#examples

Original issue reported on code.google.com by carltond...@gmail.com on 25 Jul 2013 at 10:52

GoogleCodeExporter commented 8 years ago
I should probably add that I can see the "selfLink" value in response body when 
calling storage.object.get but I don' know where to pass this in order to 
initiate an authenticated download

Original comment by carltond...@gmail.com on 25 Jul 2013 at 10:56

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I have found that something like this works

    $request = new Google_HttpRequest($download_url, 'GET');
    $httpRequest = $this->client->getIo()->authenticatedRequest($request);
    echo $httpRequest->getResponseBody();

But instead of using the selfLink URL (which uses the domain 
www.googleapis.com) from the response I get from the Cloud Storage API I had to 
create the same selfLink URL but from the domain storage.googleapis.com. (e.g. 
storage.googleapis.com/<bucket>/<object>)

Can you explain if this behaviour is intended and why the API returns a URL 
that I can't download the file from?

Original comment by carltond...@gmail.com on 25 Jul 2013 at 12:54

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