web analytics
Loading Google Custom Search...

Upload a File to a Google Docs Collection in PHP

By: Arvin

Google Docs Home

From the documentation:

The Google Documents List API allows developers to create, retrieve, update, and delete Google Docs (including but not limited to text documents, spreadsheets, presentations, and drawings), files, and collections. It also provides some advanced features like resource archives, Optical Character Recognition, translation, and revision history.

You will find this API useful if you need to store data in the cloud, perform resource management, convert document formats, etc. All interactions with the API require a valid Google Account, which can be a “consumer” account (e.g. Gmail), or a Google Apps account.

Now if you want to provide other people an option to send you files easily, then you can use this script to upload files to your Google Docs account, either on Google or Google Apps. You just have to plug in your email address and password to make it work. What it does is to (1) get the list of collections from the Google Docs account, to later provide the user an option to select which folder to upload the file to; (2) then provide the user a HTML form to select a file for upload; (3) finally, the script uploads the file to the selected collection. Read the rest of this article »

5 Comments | Permalink

Get a User’s Google Email Address via OAuth2 in PHP

By: Arvin

google oauth2 grant access page

OAuth2 is far easier to do than the original OAuth which requires that all data is signed each time. Here is an example script to retrieve a user’s Google email address (GMail or Google Apps account) which is useful if you want to authenticate users for your application but do not want to make them sign up with another account; or if you want to get the user’s email address and not worry about sending verification emails.

Before making OAuth2 requests on Google data, you first need to register an application on Google’s API Console to get a client_id and client_secret. You also need to setup valid redirect_uri‘s that your application will use. Read the rest of this article »

6 Comments | Permalink

List of Google Services’ Service Names

By: Arvin

This is the list of different Google Services’ service names for use with Google’s ClientLogin API for Installed Apps, but I just compiled these for future reference and haven’t tested all of them.

Aardvark lso
Adsense adsense
Adwords adwords
Alerts alerts
Analytics analytics*
Apps apps*
App Engine ah
Base gbase*
Blogger blogger*
Bookmarks bookmarks
Books print*
Buzz none (only supports OAuth)
Calendar cl*
Checkout sierra
Code Search codesearch*
Contacts cp*
Custom Search cprose
Developer Console devconsole
Documents writely*
DoubleClick for Publishers gam
Feedburner feedburner
Finance finance*
Friend Connect peoplesense
iGoogle ig
Insights for Search trendspro
GMail mail*
Groups groups2
Health health*
Knol knol
Latitude friendview
Map Maker geowiki
Maps local*
Merchant Center merchants
Moderator moderator
Music sj
News news
Notebook notebook
Offers offers
Orkut orkut
Panoramio panoramio
Picasa Web Albums lh2*
Places lbc
Project Hosting code
Reader reader
Sidewiki annotateweb*
Sites jotspot*
Spreadsheets wise*
Trends trends
URL Shortener urlshortener
Voice grandcentral
Web Elements ahsid
Webmaster Tools sitemaps*
Website Optimizer websiteoptimizer
Youtube youtube*

*implements the Google Data Protocol

I wrote this post because I recently answered 2 questions on Stackoverflow, which are: exporting Google Trends data and getting the list of sites in Webmaster Tools. Both problems needed user authentication which can be done using the same idea used when sending SMS via Google Voice.

Firefox’s Firebug addon and Chrome’s Developer Tools are our friends and always look out for values that start with DQAAA.

I also wrote a simple no-cURL clientlogin class for getting them Auth keys easily. Be sure to check it out.

2 Comments | Permalink