我一直在尝试使用 guzzle 从 bulksms.com 发送批量短信,它返回此错误,
guzzlehttp\exception\clientexception 客户端错误:发布 https://api.bulksms.com/v1/messages导致需要 401 完整身份验证才能访问此资源响应::“type”“ https://developer.bulksms.com /json/v1/errors#authentication-failed
我的代码
$client = new Client([
'base_uri'=>'https://www.bulksms.com/',
'timeout'=>'900.0'
]);
//$result = $client->post('', [
// 'form_params' => [
// 'sample-form-data' => 'value'
// ]
//]);
$result = $client->request('POST','https://api.bulksms.com/v1/messages', [
'form_params' => [
'username' => 'username',
'password' => '****',
'sender' => 'my appname',
'recipients' => '+5555555555',
'message' => 'Testing message',
]
]);