Это мой локон:
curl -H "Content-Type: multipart/form-data" -H "X-Token:<token>" -F payloadSend="{ "alias": "<alias>", "startDate": null, "endDate": null, "period": null, "recurrencesNumber": null, "recurrencesInterval": null, "validityPeriod": null, "sentNotify": false, "deliveredNotify": false, "msisdnToNotify":null, "sr": false, "campaignChannel": { "channelName": "UCP", "zone": null, "zoneType": null, "collectionTime": null }, "campaignMessage": { "messageType": null, "messageContent": "<testo>", "template": null, "file": "string", "msisdn": "<msisdn>", "listMsisdn": null, "fileMsisdn": "null", "name": null, "surname": null, "extra": null, "status": "string", "delivered": "string" } };type=application/json" "https://channel-ssc-api.services.smb.telecomitalia.it/channels/UCP/campaigns?destination =msisdn&message=static&delivery=immediate&type=single" --trace- ascii -
Это моя функция:
$client = new Client();
$payload = [
"alias" => "Something",
"startDate" => null,
"endDate" => null,
"period" => null,
"recurrencesNumber" => null,
...
]
];
$params = [
'destination ' => 'msisdn',
'message' => 'static',
'delivery' => 'immediate',
'type' => 'single',
];
//$curl->setHeader("Content-Type", "multipart/form-data");
$url = "https://channel-ssc-api.services.smb.telecomitalia.it/channels/UCP/campaigns?destination=msisdn&message=static&delivery=immediate&type=single";
//$url = "https://channel-ssc-api.services.smb.telecomitalia.it/channels/UCP/campaigns";
$headers = [
"X-Token" => $this->token,
'Content-Type' => "multipart/form-data"
];
$res = $client->request('POST', $url, [
'headers' => $headers,
]);
Я не понимаю, как интегрировать payloadSend в код PHP. Важно, что в конце полезной нагрузки написано: application / json Заранее спасибо. Я бился с этой проблемой часами