当前位置: 首页>>代码示例>>PHP>>正文


PHP Google_Client::setClientid方法代码示例

本文整理汇总了PHP中Google_Client::setClientid方法的典型用法代码示例。如果您正苦于以下问题:PHP Google_Client::setClientid方法的具体用法?PHP Google_Client::setClientid怎么用?PHP Google_Client::setClientid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Google_Client的用法示例。


在下文中一共展示了Google_Client::setClientid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: curl

/** I hope you are here by creating google web application, obtaining clientID and client secrete
 * if not, got to Google developer console and create app under an API Manager menu
 *
 */
session_start();
//include google api library
include 'vendor/autoload.php';
//or wherever autoload.php is located
$google_client_id = 'your Application client ID';
$google_client_secret = 'your client secrete key';
$google_redirect_uri = 'uri to process response form google';
// either self or other php file eg. http://localhost/appname/output.php -- for local machine
//setup new google client
$client = new Google_Client();
$client->setApplicationName('your application name');
$client->setClientid($google_client_id);
$client->setClientSecret($google_client_secret);
$client->setRedirectUri($google_redirect_uri);
$client->setAccessType('online');
$client->setScopes('https://www.google.com/m8/feeds');
$googleImportUrl = $client->createAuthUrl();
// creating a curl function
function curl($url, $post = "")
{
    $curl = curl_init();
    $userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)';
    curl_setopt($curl, CURLOPT_URL, $url);
    //The URL to fetch. This can also be set when initializing a session with curl_init().
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    //TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
开发者ID:tsuyog,项目名称:gmailcontactextractor,代码行数:31,代码来源:index.php

示例2: get_drive_client

 /**
  * @return \Google_Client
  */
 public static function get_drive_client()
 {
     $client = new \Google_Client();
     $client->setApplicationName('My WP Backup');
     $client->setClientid(base64_decode('ODkwOTA4NDc4NDUzLXNhN3MybHU4ZzVidnBrNXYxMTM2ODJpNmtpdmEyMzEzLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29t'));
     $client->setClientSecret(base64_decode('amp6ek04QUxJd0sxTW5DNjJBbDRlUmFG'));
     $client->setScopes(array('https://www.googleapis.com/auth/drive'));
     $client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
     $client->setAccessType('offline');
     return $client;
 }
开发者ID:guysyml,项目名称:software,代码行数:14,代码来源:Job.php


注:本文中的Google_Client::setClientid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。