我试图像这样用枪g从emarsys获取contactdata
$client = new Client([
'base_uri' => 'www.ApiUrl.com',
]);
$request = $client->request($requestType, $endPoint, [
'query' => $sQuery,
'debug' => true,
'body' => $sPostFields,
'headers' => [
'Content-type: application/json;charset="utf-8"',
],
]);
我总是收到400错误请求。
答案 0 :(得分:0)
尝试这种方式:
use GuzzleHttp\Client;
$client = new \GuzzleHttp\Client();
$response = $client->request('POST','www.ApiUrl.com',[
'headers' => [
'content-type' => 'application/x-www-form-urlencoded'
],
'form_params' => [
'name'=>$name,
'to' =>$email,
],
]);