我在添加订阅者和 OAuth 2.0 示例中使用 aweber api 使用签名 php
require_once('aweber_api/aweber_api.php');
$body = [
'ad_tracking' => 'ebook',
'custom_fields' => [
'apple' => 'fuji',
'pear' => 'bosc'
],
'email' => 'anand@gmail.com',
'ip_address' => '192.168.1.1',
'last_followup_message_number_sent' => 0,
'misc_notes' => 'string',
'name' => 'Anand',
'strict_custom_fields' => 'true',
'tags' => [
'slow',
'fast',
'lightspeed'
]
];
$headers = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'User-Agent' => 'AWeber-PHP-code-sample/1.0'
];
$listId='myid';
$accountId='myid';
$url = "https://api.aweber.com/1.0/accounts/{$accountId}/lists/{$listId}/subscribers";
$response = $client->post($url, ['json' => $body, 'headers' => $headers]);
echo $response->getHeader('Location')[0];
错误代码 :
注意:未定义变量:第 30 行 D:\xampp\htdocs\Aweber\index.php 中的客户端
致命错误:未捕获错误:在 D:\xampp\htdocs\Aweber\index.php:30 中调用成员函数 post() 堆栈跟踪:#0 {main} 在 D:\xampp\htdocs\Aweber\ 中抛出第 30 行的 index.php