Skip to content

Instantly share code, notes, and snippets.

@avtehnik
Created August 19, 2013 10:51
Show Gist options
  • Save avtehnik/6267903 to your computer and use it in GitHub Desktop.
Save avtehnik/6267903 to your computer and use it in GitHub Desktop.
"require": {
"zendframework/zendgdata": "2.0.*"
},
  private function googleLogin() {
$service = \ZendGData\Spreadsheets::AUTH_SERVICE_NAME;
$clientAdapter = new \Zend\Http\Client\Adapter\Curl();
$clientAdapter->setCurlOption(CURLOPT_SSL_VERIFYHOST, false);
$clientAdapter->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
$httpClient = new \ZendGData\HttpClient();
$httpClient->setAdapter($clientAdapter);
try {
$client = \ZendGData\ClientLogin::getHttpClient("mail@gmail.com", "pass", $service, $httpClient);
} catch (Zend_Gdata_App_CaptchaRequiredException $e) {
echo '<a href="' . $e->getCaptchaUrl() . '">CAPTCHA answer required to login</a>';
} catch (\ZendGData\Zend_Gdata_App_AuthException $e) {
echo 'Error: ' . $e->getMessage();
if ($e->getResponse() != null) {
echo 'Body: ' . $e->getResponse()->getBody();
}
}
return $client;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment