hi julian..
I am seeing only ClientLogin token in every example of delete contact's
photo. Can't this possible with authSubToken??& bye the way. I just try Zend
GData framework to check photo deletion. But no effect of it also.
StatusCode 200 & image remains as it is. below is my code. here i have ussed
clientLogin token.
require_once '../Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata');
$client = Zend_Gdata_ClientLogin::getHttpClient("[email protected]","password",
"cp");
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('
http://www.google.com/m8/feeds/contacts/default/full');
$query->setMaxResults(100);
$feed = $gdata->getFeed($query);
$token = $client->getClientLoginToken();
foreach ($feed as $entry)
{
foreach($entry->link as $link)
{
if(ereg("rel#edit-photo",$link->rel))
{
$client->setUri($link->href);
$client->setHeaders( array("Content-type: image/*","Authorization:
GoogleLogin auth=".$token,"X-HTTP-Method-Override: DELETE") );
$http_response = $client->request('POST');
}
}
}
What is wrong in this code i am not getting. if i use same code to delete
Contact (by edit URL) then it works, but doesn't affect the contact's photo.
On Wed, Apr 15, 2009 at 9:59 PM, Julian (Google) <[email protected]> wrote:
>
> Hi,
>
> You cannot use the AuthSub Token for Client Login.
>
> For AuthSub, make sure you have the scope and the hd parameter setup
> correctly. The scope should be: http://www.google.com/m8/feeds/contacts/
> and the hd parameter should be your domain if it is different than
> gmail.com. You can find more information:
> http://code.google.com/apis/accounts/docs/AuthSub.html#AuthSub
>
> --Julian
>
> On Apr 15, 4:24 pm, Devang Parekh <[email protected]> wrote:
> > hi julian, I try as you suggest but now http_code is 401. can i use my
> > authSubToken as GoogleLogin authToken?? means i am using token that never
> > expires & you are suggesting token i.e. available by providing userName &
> > p/w. Can this be a reason for 401??
> >
> > On Wed, Apr 15, 2009 at 8:26 PM, Julian (Google) <[email protected]>
> wrote:
> >
> > > Hi,
> >
> > > This should work for ClientLogin, change Authorization: AuthSub
> > > token="yourAuthToken" if you want to use AuthSub.
> >
> > > <?php
> >
> > > $url = "http://www.google.com/m8/feeds/photos/media/user%40domain.com/
> > > 1"; # 1 is a CONTACT-ID
> > > $authToken = "DQ...";
> >
> > > $header[] = "Authorization: GoogleLogin auth=".$authToken;
> > > $header[] = "Content-type: application/x-www-form-urlencoded";
> > > $header[] = "If-Match: *";
> > > $header[] = "GData-Version: 2";
> >
> > > $ch = curl_init();
> > > curl_setopt($ch, CURLOPT_URL, $url);
> > > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> > > curl_setopt($ch, CURLOPT_FAILONERROR, true);
> > > curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"DELETE");
> > > curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
> >
> > > $output = curl_exec($ch);
> > > $info = curl_getinfo($ch);
> >
> > > print_r( $info ); # you should get a http_code 200
> >
> > > ?>
> >
> > > --Julian
> >
> > > On Apr 15, 2:49 pm, Devang Parekh <[email protected]> wrote:
> > > > hi julian...
> > > > Thanks for reply but there is no change. Image is still there.
> >
> > > > $url =
> > >http://www.google.com/m8/feeds/photos/media/user%40domain.com/44e1ab3.
> ..
> >
> > > > $header[] = "Authorization: AuthSub token=".$authToken;
> > > > $header[] = "Content-type: application/x-www-form-urlencoded";
> > > > $header[] = "If-Match: *";
> > > > $header[] = "GData-Version: 2";
> > > > $header[] = "X-HTTP-Method-Override: DELETE";
> > > > $header[] = "Cache-Control: no-cache";
> > > > $header[] = "Connection: close";
> >
> > > > $ch = curl_init();
> > > > curl_setopt($ch, CURLOPT_URL, $url);
> > > > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> > > > curl_setopt($ch, CURLOPT_FAILONERROR, true);
> > > > curl_setopt($ch, CURLOPT_POST,1);
> > > > curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
> > > > curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
> > > > $response = curl_exec($ch);
> >
> > > > This is my actual code. Reply soon plz..
> >
> > > > On Wed, Apr 15, 2009 at 6:53 PM, Julian (Google) <[email protected]>
> > > wrote:
> >
> > > > > Hi,
> >
> > > > > You could try to do a HTTP DELETE like the following sample, using
> the
> > > > > Contact Photo Link and any ETag (or an specific one if necessary):
> >
> > > > > DELETEhttp://
> www.google.com/m8/feeds/photos/media/user%40domain.com/1
> > > > > Authorization: GoogleLogin auth=DQ...
> > > > > If-Match: *
> > > > > Content-Type: application/x-www-form-urlencoded
> > > > > GData-Version: 2
> >
> > > > > -Julian
> >
> > > > > On Apr 14, 1:42 pm, D2 <[email protected]> wrote:
> > > > > > HTTP - HEADER
> >
> > > > > > "Host:www.google.com"
> > > > > > "MIME-Version: 1.0"
> > > > > > "Accept: text/plain"
> > > > > > "Content-type: image/*"
> > > > > > "Authorization: AuthSub token=AUTH-TOKEN"
> > > > > > "X-HTTP-Method-Override: DELETE"
> > > > > > "Cache-Control: no-cache"
> > > > > > "If-Match: E-TAG"
> > > > > > "GData-Version: 2"
> > > > > > "Connection: close"
> >
> > > > > > URL :
> > > > >
> http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc.
> > > ..
> >
> > > > > > I want to delete photo for a perticular Contact. Above is my
> > > > > > http_header to delete photo. & url is same as i get from
> "rel#photo".
> >
> > > > > > when i proccess this, I get http_response 200. But image remains
> as
> > > it
> > > > > > is.
> >
> > > > > > Anything wrong in this code?? please reply soon
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---