我的一个网站正在使用 Aweber 已弃用的 API ( https://github.com/aweber/AWeber-API-PHP-Library ),它之前工作正常但停止了,这个 API 的实现已经由另一个开发人员完成,现在该网站由我处理,我从未与 Aweber 合作过,谁能帮我将 OAuth 1.0 替换为 OAuth 2.0。
用户注册后收到的错误是这样的。
这是发送欢迎电子邮件的 YII 注册控制器
if ($model->load(\Yii::$app->request->post()) && $model->register()) {
$this->trigger(self::EVENT_AFTER_REGISTER, $event);
$consumerKey = 'XXXXXXXXXXXXXXXXXXXXXXXX';
$consumerSecret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX';
$accessKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$accessSecret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$list_id = '3857937';
$aweber = new \AWeberAPI($consumerKey, $consumerSecret);
try {
$account = $aweber->getAccount($accessKey, $accessSecret);
$account_id = $account->id;
$listURL = "/accounts/{$account_id}/lists/{$list_id}";
$list = $account->loadFromUrl($listURL);
$params = array(
'email' => $model->email,
'ad_tracking' => 'My_Web_Form_3',
'name' => $model->username
);
$subscribers = $list->subscribers;
$new_subscriber = $subscribers->create($params);
} catch(AWeberAPIException $exc) {
}
return $this->render('message', [
'title' => \Yii::t('user', 'Your account has been created'),
'module' => $this->module,
]);
}
return $this->render('register_w', [
'model' => $model,
'module' => $this->module,
]);
}