Is it possible to send POST data with header() in PHP?

It is not possible to send POST data with the header() function in PHP. To send POST data, you can use cURL or the file_get_contents() function with stream context options to make an HTTP request with the desired POST data.

$data = array('key1' => 'value1', 'key2' => 'value2');

$options = array(
    'http' => array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query($data)
    )
);

$context  = stream_context_create($options);
$result = file_get_contents('http://example.com/submit.php', false, $context);

echo $result;