【发布时间】:2019-07-16 03:43:55
【问题描述】:
我在添加订阅者和 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() 为 null 堆栈跟踪:#0 {main} 在 D:\xampp\htdocs 中抛出\Aweber\index.php 第 30 行
【问题讨论】:
-
你认为
$client是在哪里定义的? -
不起作用,这是 get post 方法....
-
$client根本没有在您的代码中定义......这就是我们可以说的全部