[英]Mailgun - Invalid resource type: array on put method
I am working with mailgun php sdk. 我正在使用mailgun php sdk。 But I am getting error (Invalid resource type: array) when I try to update a user from mailing list.
但是当我尝试从邮件列表更新用户时,我收到错误(无效的资源类型:数组) 。 My Code is bellow.
我的代码如下。
$client = new \Http\Adapter\Guzzle6\Client();
$mgClient = new \Mailgun\Mailgun('YOUR_API_KEY', $client);
$listAddress = 'LIST@YOUR_DOMAIN_NAME';
$memberAddress = 'bob@example.com';
# Issue the call to the client.
$result = $mgClient->put("lists/$listAddress/members/$memberAddress", array(
'subscribed' => 'no',
'name' => 'Foo Bar'
));
First, make sure you are using the last version of php-http/guzzle6-adapter
, then try the following: 首先,确保您使用的是最新版本的
php-http/guzzle6-adapter
,然后尝试以下操作:
$client = \Http\Adapter\Guzzle6\Client::createWithConfig([
'headers' => [
'Content-Type' => 'application/x-www-form-urlencoded'
]
]);
$mgClient = new \Mailgun\Mailgun('YOUR_API_KEY', $client);
$listAddress = 'LIST@YOUR_DOMAIN_NAME';
$memberAddress = 'bob@example.com';
# Issue the call to the client.
$result = $mgClient->put("lists/$listAddress/members/$memberAddress", http_build_query([
'subscribed' => 'no',
'name' => 'Foo Bar'
]));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.