gpt4 book ai didi

api - 无法删除订阅者 aweber api php 包装器

转载 作者:行者123 更新时间:2023-12-04 04:54:07 25 4
gpt4 key购买 nike

正如删除订阅者的文档所预期的那样,但它不起作用

require_once('aweber_api/aweber_api.php');

$consumerKey = '***'; # put your credentials here
$consumerSecret = '***'; # put your credentials here
$accessKey = '***'; # put your credentials here
$accessSecret = '***'; # put your credentials here
$account_id = '***'; # put the Account ID here
$list_id = '***'; # put the List ID here

$aweber = new AWeberAPI($consumerKey, $consumerSecret);

try {
$account = $aweber->getAccount($accessKey, $accessSecret);
$listURL = "/accounts/{$account_id}/lists/{$list_id}";
$list = $account->loadFromUrl($listURL);

# subscriber to delete
$params = array(
'email' => 'johndoe@example.com'
);
$subscribers = $list->subscribers;
$new_subscriber = $subscribers->delete($params);

# success!
print "Subscriber was deleted!";

} catch(AWeberAPIException $exc) {
print "<h3>AWeberAPIException:</h3>";
print " <li> Type: $exc->type <br>";
print " <li> Msg : $exc->message <br>";
print " <li> Docs: $exc->documentation_url <br>";
print "<hr>";
exit(1);
}

我的引用 https://labs.aweber.com/snippets/subscribers#del

最佳答案

试试这个代码。它为我工作

require_once('aweber_api/aweber_api.php');

$consumerKey = '###';
$consumerSecret = '###';
$accessKey = '###';
$accessSecret = '###';
$account_id = '###';
$list_id = '###';

$aweber = new AWeberAPI($consumerKey, $consumerSecret);

try {
$account = $aweber->getAccount($accessKey, $accessSecret);
$listURL = "/accounts/{$account_id}/lists/{$list_id}";
$list = $account->loadFromUrl($listURL);

$params = array(
'email' => 'info@examples.com'
);

$subscribers = $list->subscribers;
$found_subscribers = $subscribers->find($params);

foreach ($found_subscribers as $subscriber) {
$subscriber->delete();
}

print "Subscriber was deleted!";

} catch(AWeberAPIException $exc) {

print "AWeberAPIException:";
print "Type: $exc->type";
print "Msg : $exc->message";
print "Docs: $exc->documentation_url";
exit(1);
}

关于api - 无法删除订阅者 aweber api php 包装器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17018373/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com