我正在努力使用php重置gmail密码,我已经关注此link1和link2。运行此代码时抛出PHP Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400
/usr/share/php/Zend/Gdata/App.php:717中的请求URI无效
我的代码:
<?php
//Change this for your domain
$domain = 'http://www.gmail.com/';
$email = 'mymail@gmail.com';
$passwd = 'myoldpasswd';
$user = 'mymail@gmail.com';
$newuserpassword = 'mynewpasswd';
//Connect as admin to Google Appss
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, Zend_Gdata_Gapps::AUTH_SERVICE_NAME);
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n";
echo 'Token ID: ' . $cre->getCaptchaToken() . "\n";
} catch (Zend_Gdata_App_AuthException $ae) {
echo 'Problem authenticating: ' . $ae->exception() . "\n";
}
$gdata = new Zend_Gdata_Gapps($client, $domain);
//Now change the user's password
$updateUser = $gdata->retrieveUser($user);
$updateUser->login->password = $newuserpassword;
$updateUser = $updateUser->save();
$user->login->changePasswordAtNextLogin = true;
?>
错误:
PHP Notice: Undefined offset: 1 in /usr/share/php/Zend/Gdata/ClientLogin.php on line 150
PHP Stack trace:
PHP 1. {main}() /home/raj2/Documents/gmail/update.php:0
PHP 2. Zend_Gdata_ClientLogin::getHttpClient() /home/raj2/Documents/gmail/update.php:17
PHP Notice: Undefined variable: php_errormsg in /usr/share/php/Zend/Gdata/Gapps/ServiceException.php on line 173
PHP Stack trace:
PHP 1. {main}() /home/raj2/Documents/gmail/update.php:0
PHP 2. Zend_Gdata_Gapps->retrieveUser() /home/raj2/Documents/gmail/update.php:27
PHP 3. Zend_Gdata_Gapps->getUserEntry() /usr/share/php/Zend/Gdata/Gapps.php:938
PHP 4. Zend_Gdata->getEntry() /usr/share/php/Zend/Gdata/Gapps.php:535
PHP 5. Zend_Gdata_App->getEntry() /usr/share/php/Zend/Gdata.php:187
PHP 6. Zend_Gdata_App->importUrl() /usr/share/php/Zend/Gdata/App.php:228
PHP 7. Zend_Gdata_Gapps->get() /usr/share/php/Zend/Gdata/App.php:771
PHP 8. Zend_Gdata_Gapps::throwServiceExceptionIfDetected() /usr/share/php/Zend/Gdata/Gapps.php:224
PHP 9. Zend_Gdata_Gapps_ServiceException->importFromString() /usr/share/php/Zend/Gdata/Gapps.php:172
PHP Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400
Invalid request URI' in /usr/share/php/Zend/Gdata/App.php:717
Stack trace:
#0 /usr/share/php/Zend/Gdata.php(221): Zend_Gdata_App->performHttpRequest('GET', 'https://apps-ap...', Array, NULL, NULL, NULL)
#1 /usr/share/php/Zend/Gdata/App.php(883): Zend_Gdata->performHttpRequest('GET', 'https://apps-ap...', Array)
#2 /usr/share/php/Zend/Gdata/Gapps.php(222): Zend_Gdata_App->get('https://apps-ap...', NULL)
#3 /usr/share/php/Zend/Gdata/App.php(771): Zend_Gdata_Gapps->get('https://apps-ap...', NULL)
#4 /usr/share/php/Zend/Gdata/App.php(228): Zend_Gdata_App->importUrl('https://apps-ap...', 'Zend_Gdata_Gapp...', NULL)
#5 /usr/share/php/Zend/Gdata.php(187): Zend_Gdata_App->getEntry('https://apps-ap...', 'Zend_Gdata_Gapp...')
#6 /usr/share/php/Zend/Gdata/Gapps.php(535): Zend_Gdata->getEntry('https://apps-ap...', 'Zend_Gdata_Gapp...')
#7 /usr/share/php/Zend/Gdata/Gapps.php(938): Zend_Gdata_Gapps->getUserEntry(Object(Zend_ in /usr/share/php/Zend/Gdata/App.php on line 717