PHP HTTP Headers

How to get HTTP headers in response to a POST request I made with PHP?

+3
source share
3 answers

How did you post POST? I use a socket and then read the answer where I get the headers and body.

0
source

Create an HTTP stream context and pass it to file_get_contents(). Subsequently, you can:

$metaData = stream_get_meta_data($context);
$headers = $metaData['wrapper_data'];
+2
source

you will find them in a superglobal $_SERVER... everything that starts with HTTP_should be a header ... it depends on the server how well it will work ...

Greetz

back2dos

+1
source

Source: https://habr.com/ru/post/1712958/


All Articles