Created
August 19, 2013 10:51
-
-
Save avtehnik/6267903 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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