brianb
brianb

Reputation: 29

Zend_Gdata_addRecipientToEmailList Error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400

I have PHP code that is managing mailing lists using the Provisioning API. Visitors are able to opt in or out of the mailing list via a web form. It has been working for ~6 months and stopped working 10/1/2013.

I am using this code for testing:

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
$service = Zend_Gdata_Gapps::AUTH_SERVICE_NAME  ;

$username = 'my_username';
$password = 'my_password';
$domain = 'my_domain';
$email = '[email protected]';
$email_list = 'test-list';

$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$gdata = new Zend_Gdata_Gapps($client, $domain);
$gdata->addRecipientToEmailList($email, $email_list);

I'm receiving the following error message:

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:716\nStack trace:
#0 /usr/share/php/Zend/Gdata.php(219): Zend_Gdata_App->performHttpRequest('POST', 'https://apps-ap...', Array, '<atom:entry xml...', 'application/ato...', NULL)
#1 /usr/share/php/Zend/Gdata/App.php(908): Zend_Gdata->performHttpRequest('POST', 'https://apps-ap...', Array, '<atom:entry xml...', 'application/ato...')
#2 /usr/share/php/Zend/Gdata/Gapps.php(247): Zend_Gdata_App->post(Object(Zend_Gdata_Gapps_EmailListRecipientEntry), 'https://apps-ap...', NULL, NULL, Array)
#3 /usr/share/php/Zend/Gdata/App.php(983): Zend_Gdata_Gapps->post(Object(Zend_Gdata_Gapps_EmailListRecipientEntry), 'https://apps-ap...', NULL, NULL, Array)
#4 /usr/share/php/Zend/Gdata/Gapps.php(840): Zend_Gdata_App->insertEntry(Object(Zend_Gdata_Gapps_EmailListRecipientEntry), 'https://apps-ap...', 'Zend_Gdata_Gapp...')
#5 /usr/share/php/Zend/Gdata/Gapps.php(1625): Zend_G in /usr/share/php/Zend/Gdata/App.php on line 716

Can anyone tell me what happened? And what I need to do to get this working again?

Thanks, B

Upvotes: 1

Views: 892

Answers (1)

Oleg_L
Oleg_L

Reputation: 11

Google completely remove support for emaillists. Use groups instead lists.

Example:

instead $gdata->addRecipientToEmailList($email, $email_list)

use $gdata->addMemberToGroup($email, $group_name)

deleteEmailList -> deleteGroup

createEmailList -> createGroup

getEmailListRecipientFeed -> retrieveAllMembers

See full syntax in Zend docs: http://framework.zend.com/manual/1.12/en/zend.gdata.gapps.html

Upvotes: 1

Related Questions