PHP Version 5.3.5
Zend Engine v2.3.0

I can run a simple script to log onto my Google Apps API to create users etc 
but I need to run this behind my College's proxy server. From behind the 
proxy I get a 'Unable to Connect to ssl://www.google.com:443' error message.

My original code:

<?php
set_include_path('C:\\Program Files\\Zend\\ZendServer\\GUI\\library\\');

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
$email = xxx';
$password = 'xxx';
$domain = xxx.ac.uk';
$service_type = Zend_Gdata_Gapps::AUTH_SERVICE_NAME;

// Instantiate a client object
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, 
$service_type);

$service = new Zend_Gdata_Gapps($client, $domain);
$result = $service->retrieveUser('xxx');
print_r($result);

?>

I have tried numerous attempts to get it to work via a proxy eg

<?php
set_include_path('C:\\Program Files\\Zend\\ZendServer\\GUI\\library\\');

require_once "Zend/Http/Client/Adapter/Proxy.php";
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
$email = 'xxx';
$password = 'xxx';
$domain = 'xxx.ac.uk';
$service_type = Zend_Gdata_Gapps::AUTH_SERVICE_NAME;

$config = array(
    'adapter'    => 'Zend_Http_Client_Adapter_Proxy',
    'proxy_host' => 'x.x.x.x',
    'proxy_port' => 8080
);

// Instantiate a client object
clientp = new Zend_Http_Client();
$clientp->setConfig($config);
$client = Zend_Gdata_ClientLogin::getHttpClient($email, 
$password,$service_type,$clientp);

$service = new Zend_Gdata_Gapps($client, $domain);
$result = $service->retrieveUser('xxx');
print_r($result);

?>

- this results in a Call to undefined method 
Zend_Http_Client::setClientLoginToken() error

My last attempts results in a server error even tho other users report using 
it successfully.

username = 'xxx';
$password = 'xxx';
$domain = 'xxx.ac.uk';

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_App_HttpException');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Docs');

Zend_Loader::loadClass('Zend_Http_Client_Exception');
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Http_Client_Adapter_Proxy');

$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;

// Configure the proxy connection
$config = array(
    'adapter'    => 'Zend_Http_Client_Adapter_Proxy',
    'proxy_host' => 'x.x.x.x',
    'proxy_port' => 8080
);

$proxiedHttpClient = new Zend_Http_Client('http://www.google.com:443', 
$config);


try {
  $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $password, 
$service, $proxiedHttpClient);

} catch (Zend_Gdata_App_HttpException $httpException) {
  exit("An error occurred trying to connect to the proxy server\n" .        
    $httpException->getMessage() . "\n");
}

$service_go = new Zend_Gdata_Gapps($client, $domain);
$result = $service_go->retrieveUser('xxx');
print_r($result);

?>

Any help would be appreciated.

Cheers,

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-apps-mgmt-apis/-/7PO7J_Cz-pwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Reply via email to