Google cPanel and Zend/PHP-Collection of common programming errors
Im trying to retrieve all users from a domain, but I get an error..
Have downloaded the Zend library
Docs:
https://developers.google.com/google-apps/provisioning/?hl=da#retrieving_user_accounts
Get this error:
Fatal error: Call to undefined method Zend_Gdata_HttpClient::retrieveAllUsers()
script:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
$email = '[email protected]';
$password = 'password';
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Gapps::AUTH_SERVICE_NAME);
echo '
';
print_r($client->retrieveAllUsers());
echo '
';
-
Seems like you try to access the retrieveAllUsers method on an instance of the wrong object (Zend_Gdata_HttpClient instead of Zend_Gdata_Gapps).
Try this:
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Gapps::AUTH_SERVICE_NAME); $gdata = new Zend_Gdata_Gapps($client, 'mydomain.com'); $users = $gdata->retrieveAllUsers();
Originally posted 2013-11-09 22:56:15.