dounou9751 2013-04-09 07:35
浏览 18

php应用程序用zend框架检索谷歌联系人

THis is regarding to retrive my google contact using gdata library of zend framework. I am able to retrieve my all google contact with username and password. But i want something different like retrieve it with secret ky and seceret id for that i have regestered my application with outh2.0 in google console api and retrieve secrate key and seceret id. using this seceret id i am able to retrieve token as well but i dont know how to retrive my google contact using this token can any on help..

  • 写回答

1条回答 默认 最新

  • dougou1127 2013-04-10 08:43
    关注

    https://github.com/jcleblanc/oauth/tree/master/oauth2-php-google

    This link was provided in a previous question and has a complete example of fetching the Contacts feed with PHP and OAuth 2.0.

    If you're trying to access the contacts of accounts in a Google Apps domain you administer, you can use two-legged authentication (2LO) and OAuth 1.0 in Zend. Then you generate a consumer key and consumer secret key, and create the http client like this:

    $oAuthOptions = array(
        'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER,
        'version' => '1.0',
        'signatureMethod' => 'HMAC-SHA1',
        'consumerKey' => [YOUR CONSUMER KEY],
        'consumerSecret' => [YOUR CONSUMER SECRET],
        'xoauth_requestor_id' => [EMAIL OF ACCOUNT TO ACCESS]
    );
    
    $consumer = new Zend_Oauth_Consumer($oAuthOptions);
    $token = new Zend_Oauth_Token_Access();
    
    $client = $token->getHttpClient($oAuthOptions,null);
    

    More on two/three legged authentication on OAuth 1.0: https://code.google.com/p/google-mail-xoauth-tools/wiki/PhpSampleCode

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题