Передача значений $_POST с помощью cURL

Ross has the right idea для отправки обычного формата php.ini параметра/значения в URL-адрес.

Недавно php-date я столкнулся с ситуацией, когда php-readfile мне нужно было отправить php-fpm некоторый XML как Content-Type php-date "text/xml" без post каких-либо пар параметров, поэтому php-oop вот как вы это делаете:

$xml = 'foobar';
$httpRequest = curl_init();

curl_setopt($httpRequest, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($httpRequest, CURLOPT_HTTPHEADER, array("Content-Type:  text/xml"));
curl_setopt($httpRequest, CURLOPT_POST, 1);
curl_setopt($httpRequest, CURLOPT_HEADER, 1);

curl_setopt($httpRequest, CURLOPT_URL, $url);
curl_setopt($httpRequest, CURLOPT_POSTFIELDS, $xml);

$returnHeader = curl_exec($httpRequest);
curl_close($httpRequest);

В php-date моем случае мне нужно было php.ini проанализировать некоторые php-include значения из заголовка ответа php-date HTTP, поэтому вам не обязательно phtml устанавливать CURLOPT_RETURNTRANSFER или CURLOPT_HEADER.

php

post

curl

2022-09-18T19:39:47+00:00