Zend_Gdata_addRecipientToEmailList错误:未捕获异常'Zend_Gdata_App_HttpException',消息'预期响应代码200,得到400

时间:2013-10-03 23:10:48

标签: php zend-framework gdata google-provisioning-api

我有使用Provisioning API管理邮件列表的PHP代码。访问者可以通过网络表单选择加入或退出邮件列表。它已经工作了大约6个月,并于2013年10月1日停止工作。

我正在使用此代码进行测试:

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 = 'test-email@domain.com';
$email_list = 'test-list';

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

我收到以下错误消息:

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

谁能告诉我发生了什么?我需要做些什么才能让它再次运作?

谢谢, 乙

1 个答案:

答案 0 :(得分:1)

Google完全删除了对电子邮件发送者的支持。使用组而不是列表。

示例:

代替$ gdata-&gt; addRecipientToEmailList($ email,$ email_list)

使用$ gdata-&gt; addMemberToGroup($ email,$ group_name)

deleteEmailList - &gt; deleteGroup

createEmailList - &gt; createGroup

getEmailListRecipientFeed - &gt; retrieveAllMembers

请参阅Zend文档中的完整语法: http://framework.zend.com/manual/1.12/en/zend.gdata.gapps.html