Reputation: 33
How do I obtain the HTTP headers in response to a POST request I made with PHP?
Upvotes: 3
Views: 1354
Reputation: 8781
Create an HTTP stream context and pass it into file_get_contents()
. Afterwards, you can:
$metaData = stream_get_meta_data($context);
$headers = $metaData['wrapper_data'];
Upvotes: 2
Reputation: 1153
How did you issue the POST? I use a socket and then read back the response where I get headers and body.
Upvotes: 0
Reputation: 15623
you will find them in the superglobal $_SERVER
... anything that starts with HTTP_
should be a header ... it depends on the server, how well this will work ...
greetz
back2dos
Upvotes: 1