Thyaga, I didn't realize you were using a gmail.com account, the Email Settings API is only available in Google Apps Premier, Education and Partner Editions, not Standard Edition nor Gmail.
Claudio On Fri, Feb 4, 2011 at 5:44 PM, Thyagaraja Yenketeramdoo < [email protected]> wrote: > Hi claudio, i have used cURL as u suggested and getting some problems. > > Here is my php code: > > <?php > > > function getEmailXML(){ > > $result = "<?xml version='1.0' encoding='utf-8'?>"."\n"; > > $result .= "<atom:entry xmlns:atom=' > http://www.w3.org/2005/Atom' > xmlns:apps='http://schemas.google.com/apps/2006'>"; > > $result .= "<apps:property name='from' value='calendar- > [email protected]' />"; > > $result .= "</atom:entry>"; > > return $result; > > } > > > function getAuthToken($account){ > > // Getting the google authentication token > > $tk_ch = curl_init(); > > curl_setopt($tk_ch, CURLOPT_URL, " > https://www.google.com/accounts/ > ClientLogin"); > curl_setopt($tk_ch, CURLOPT_SSL_VERIFYPEER, 0); > curl_setopt($tk_ch, CURLOPT_POST, true); > curl_setopt($tk_ch, CURLOPT_RETURNTRANSFER, true); > curl_setopt($tk_ch, CURLOPT_POSTFIELDS, $account); > > $response = curl_exec($tk_ch); > > curl_close($tk_ch); > > $str_split = split('=', $response); > > $token = $str_split[3]; > > return $token; > > } > > function email_createFilter($email_addr, $token){ > > list($username, $domain) = split('@', $email_addr); > > $ch = curl_init(); > $url_feed = " > https://apps-apis.google.com/a/feeds/emailsettings/ > 2.0/".$domain."/".$username."/filter"; > > echo $url_feed; > > curl_setopt($ch, CURLOPT_URL, $url_feed); > curl_setopt($ch, CURLOPT_POST, true); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); > curl_setopt($ch, CURLOPT_FAILONERROR, true); > curl_setopt($ch, CURLOPT_HTTPHEADER, array( > 'Authorization: GoogleLogin > auth="'.trim($token).'"', > 'Content-type: application/atom+xml' > )); > > curl_setopt($ch, CURLOPT_POSTFIELDS, getEmailXML()); > $result = curl_exec($ch); > curl_close($ch); > > if($result){ > return true; > } > > return false; > > } > > $my_acc =array( > 'accountType' => 'GOOGLE', > 'Email' => '[email protected]', > 'Passwd' => 'xxxxxxxx', > 'service' => 'apps', > ); > > $auth_token = getAuthToken($my_acc); > $test = email_createFilter('[email protected]', > $auth_token); > > var_dump($test); > > > ?> > > First i get my token using ClientLogin. Using that token a i try to > send the xml feed to the Email Settings API. Then i use > var_dump($test); to check the output. > > It always returns me false and no change is taking place on my gmail > account i.e. no filter is being created. Your help would be > nice ! :-) > > Kind regards, > Thyaga. > > On Feb 4, 5:24 pm, Thyagaraja Yenketeramdoo <[email protected]> > wrote: > > Thank you Claudio. I will try to work in creating the PHP client > > library for the Email Setting API but for now i will try your adivce > > about cURL. I dont know much about cURL. I am learning it and will > > try to implement the feature i want. Thank you again for your > > suggestion. :-) > > > > On Feb 4, 4:59 pm, Claudio Cherubino <[email protected]> wrote: > > > > > > > > > > > > > > > > > Hi Thyaga, > > > > > Unfortunately the PHP client library included in the Zend Framework is > > > not completely up-to-date and some APIs, including the Email Setting > > > API, are not implemented. > > > You can extend the library yourself to implement the protocol > > > described in our developer's guide: > > > > >http://code.google.com/intl/it/googleapps/domain/email_settings/devel. > .. > > > > > Since you don't want to use a different programming language (Java, > > > Python and .NET support the Email Settings API), an easier alternative > > > would probably be to use PHP to run cURL commands. > > > > > Claudio > > > > > On 3 Feb, 17:42, Thyagaraja Yenketeramdoo <[email protected]> > > > wrote: > > > > > > Hello everyone ! > > > > > > Need your advice. > > > > > > Scenario: I get email reminders from my Google calendar account and i > > > > want to create a filter in my gmail account that filters all those > > > > reminders and then forward them/it to a friend or partner using PHP. > > > > > > I have done some research and found that Zend Framework does not > > > > support service for gmail settings api. I absolutely need to do it > in > > > > PHP. How should i proceed? > > > > > > In dire need for help. Thank you for reading my post. > > > > > > Thyaga. > > -- > You received this message because you are subscribed to the Google Groups > "Google Apps Domain Information and Management APIs" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-apps-mgmt-apis%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" 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-apps-mgmt-apis?hl=en.
