Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP process HTTP headers

How do I obtain the HTTP headers in response to a POST request I made with PHP?

like image 310
Naumaan Avatar asked Dec 08 '25 18:12

Naumaan


1 Answers

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'];
like image 59
Steve Clay Avatar answered Dec 10 '25 07:12

Steve Clay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!