本文整理汇总了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);
示例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;
}