You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jamie Nicolson edited this page May 13, 2015
·
4 revisions
Using the PHP sample code
The PHP sample code is available for browsing in the repository, and can also be downloaded in a ZIP file.
Using this sample code requires that you already have an OAuth 2.0 access token. To authorize an access token from a PHP application, use the Google APIs Client Library for PHP. For testing, you can acquire an access token with oauth2.py.
Libraries
The download ZIP file contains a copy of the Zend framework libraries. Alternatively, you can download the Zend framework from
zend.com, or install it with your system's software package manager.
Downloading
Download the sample code package from
here, unzip it, and make sure the oauth2-php-sample is in a web-accessible directory.
Running the sample app
Visit https://<yourserver>/oauth2-php-samples/oauth2.php to run the OAuth 2.0 sample. Enter a Gmail email address and an access token that is authorized to access that account, then click Submit. You should see an output of the count of messages in your inbox along with the subject lines of the emails.
Exploring the sample code
The high-level sample code is in
Github along with plenty of comments.