我有一個捲曲這樣的代碼,我正在嘗試轉換成guzzle
像這樣轉換捲曲成狂飲代碼在PHP
$response = $client->post(self::$url, [
'query' => array(
'app_id' => "app-id",
'included_segments' => array('All'),
'contents' => $content,
'headings' => $headings) ],
['headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Basic api key'
]
]);
但是當我嘗試運行此我得到這個錯誤
...` resulted in a `400 Bad Request` response:\n{\"errors\":[\"Please include a case-sensitive header of Authorization: Basic <YOUR-REST-API-KEY-HERE> with a valid REST AP (truncated...)
捲曲
curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8','Authorization: Basic api key'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
捲曲代碼看起來像什麼? – Veve
我已經添加了捲曲代碼@Veve –