Anonymous
PHP Post получен как Get
Сообщение
Anonymous » 11 фев 2025, 01:59
Я отправляю почтовый звонок, но в соответствии с Sysadmin сервер получает Get. Что я делаю не так? Я использую классический кусок кода:
'' '< /p>
Код: Выделить всё
public function callAPI_POST (string $API_URL, array $Params) {
$EncodedParams = json_encode ($Params);
$postOptions = [
'http' => [
'method' => 'POST',
'header' => [ 'Authorization: Bearer ' . $this->getAuthToken (),
'Content-type: application/json',
'Accept: application/json' ],
'content' => $EncodedParams,
],
];
$context = stream_context_create ($postOptions);
$callReply = file_get_contents ($API_URL, false, $context);
if ($callReply === FALSE) {
$callReply = NULL;
}
if ($callReply != NULL) {
$ReplyArray = json_decode($callReply, TRUE);
'' '
Подробнее здесь:
https://stackoverflow.com/questions/794 ... ved-as-get
1739228370
Anonymous
Я отправляю почтовый звонок, но в соответствии с Sysadmin сервер получает Get. Что я делаю не так? Я использую классический кусок кода: '' '< /p> [code]public function callAPI_POST (string $API_URL, array $Params) { $EncodedParams = json_encode ($Params); $postOptions = [ 'http' => [ 'method' => 'POST', 'header' => [ 'Authorization: Bearer ' . $this->getAuthToken (), 'Content-type: application/json', 'Accept: application/json' ], 'content' => $EncodedParams, ], ]; $context = stream_context_create ($postOptions); $callReply = file_get_contents ($API_URL, false, $context); if ($callReply === FALSE) { $callReply = NULL; } if ($callReply != NULL) { $ReplyArray = json_decode($callReply, TRUE); [/code] '' ' Подробнее здесь: [url]https://stackoverflow.com/questions/79428502/php-post-received-as-get[/url]