Skip to content

Instantly share code, notes, and snippets.

@usmanfarman
usmanfarman / MyGlass.php
Created October 12, 2013 18:46
Excerpts from two classes that I'm messing around with.
/**
* Download an attachment's content.
*
* @param string item_id ID of the timeline item the attachment belongs to.
* @param Google_Attachment $attachment Attachment's metadata.
* @return string The attachment's content if successful, null otherwise.
*/
function download_attachment($item_id, $attachment) {
$request = new Google_HttpRequest($attachment->getContentUrl(), 'GET', null, null);
$httpRequest = Google_Client::$io->authenticatedRequest($request);