1

Sorry for such a bad question but I spend 2 hours without any success. Zend Docs are horrible ...

I have found this Zend_Gdata library and Picasa data API -- loader.php file missing, but its crashing at line 2 Class 'Application\Controller\Zend\Loader\StandardAutoloader' not found, which obviously isn't the correct path.

I am not sure why ZF does not use ...\vendor\ZF2\library\Zend\Loader\

Im using https://github.com/zendframework/ZendSkeletonApplication which is working, but nothing else works out of box with zf2 and all help topics are described incompletely. A mess in my eyes ...

However here is the code.

//Change this for your domain
$domain = 'yourdomain.com';
$email = 'ad...@yourdomain.com';
$passwd = 'p@ssword';
$user = 'jsmith';
$newuserpassword = 'secretp@assword';

//Connect as admin to Google Apps
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();
Community
  • 1
  • 1
Stephan Ahlf
  • 3,310
  • 5
  • 39
  • 68

2 Answers2

1

There's a new API that you can use even if Zend 1 or 2:

https://github.com/google/google-api-php-client

Here's the page with installation instructions and a getting started:

https://developers.google.com/api-client-library/php/

And here are the available services:

https://github.com/google/google-api-php-client/tree/master/src/Google/Service

Hope it help.

atilacamurca
  • 168
  • 1
  • 9
  • 12
0

There's no such thing as Zend_Loader in zf2 and the code you have posted is for zf1. If you have the barebones application working, then you will already have the autoloader working correctly (I presume you're using MVC and this code is to go in a controller, not a single file).

If you have the autoloader setup correctly, you also don't need to use Zend_Loader::loadClass.. as they will be autoloaded.

As for Gdata in zf2 - you will need to get the package, which can be found here https://packages.zendframework.com/. Good instructions are here: Zend Framework 2.0.2 YouTube API

Converting the code from zf1 to zf2 should be pretty easy.

However, unfortunately the gdata package is no longer maintained, so you are advised to use https://code.google.com/p/google-api-php-client/

Community
  • 1
  • 1
Ashley
  • 5,939
  • 9
  • 39
  • 82
  • 1
    Thanks for your answer . I downloaded the package before, but have not seen any hint that it is not supported any more. I think Zend is very cool, but often unusabel for me with this state of documentation. You pointed me to a better direction with this link https://code.google.com/p/google-api-php-client/ – Stephan Ahlf Apr 17 '13 at 06:38
  • fyi, The notice that is isn't maintained anymore is in the read me of the package – Ashley Apr 17 '13 at 20:55