Hi,
Here is a sample using Client Login:
<?php
$clientLibraryPath = '/var/www/contacts/Zend';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR .
$clientLibraryPath);
require_once 'Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Http_Response');
$client = Zend_Gdata_ClientLogin::getHttpClient("[email protected]",
"Password", "cp");
$gdata = new Zend_Gdata($client);
$link_photo = "http://www.google.com/m8/feeds/photos/media/
domainoremails/3c5fd34b888e075f";
$http_response = $gdata->get($link_photo);
$rawImage = $http_response->getBody();
$headers = $http_response->getHeaders();
$contentType = $headers["Content-type"];
header("Content-type: ".$contentType);
print_r( $rawImage );
?>
Cheers,
--Julian
On Jun 12, 12:44 pm, vittore <[email protected]> wrote:
> In the previous code, if I use:
>
> $header = array('Authorization: AuthSub token="'.$_SESSION
> ['sessionToken'].'"');
>
> the error is:
>
> Warning: file_get_contents(http://...rVRxGN97oVdzX1qg) function.file-
> get-contents]: failed to open stream: HTTP request
> failed! HTTP/1.0 401 Authorization required
>
> v.
>
> On 12 Giu, 13:25, vittore <[email protected]> wrote:
>
> > Hi,
>
> > how to retrieve contact photo using php? I have a page that get photo
> > url, so I need to build a getPhoto.php page so I can use like:
>
> > <img src='getPhoto.php?google_image_uri=http://www.google.com/m8/feeds/
> > photos/media/--user%40---domain/2333ea428ff7f466/
> > wRnjjcrVfdxGN97oVdzX1qg'>
>
> > This is my code:
> > <?php
>
> > /* file getPhoto.php */
>
> > session_start();
>
> > $header = array("Authorization: GoogleLogin auth=".$_SESSION
> > ['sessionToken']);
> > $opts = array( 'http' => array ('method'=>'GET',
> > 'header'=>$header));
> > $ctx = stream_context_create($opts);
> > $raw=file_get_contents($_REQUEST['google_image_uri'],false,$ctx);
> > echo ($raw);
>
> > ?>
>
> > Any ideas?
>
> > Thanks in advance
> > v.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---