[UPHPU] print raw http headers and body

Mac Newbold mac at macnewbold.com
Mon Oct 23 16:43:22 MDT 2006


Today at 4:29pm, Kenneth Burgener said:

> I would like to be able to get access to the raw http headers and body.
> Is there a method to do this in php?
> 
> I found getallheaders() which works very well for the headers, but I
> have not found an equivalent for the http body.  Any suggestions?

Are you talking about a HTTP body that was posted to you, or one that you 
retrieve from a server (i.e. with curl or something)?

This relates to the XML-RPC question that came up a while back, on
August 15th. The answer then was:

See the PEAR library and don't reinvent the wheel if you don't have to.
http://pear.php.net/manual/en/package.webservices.xml-rpc.php

There are two ways to access the raw post data.
1. $HTTP_RAW_POST_DATA
   affected by config option always_populate_raw_post_data
   http://php.net/manual/en/ini.core.php
2. reading it from this file wrapper php://input
   http://php.net/manual/en/wrappers.php.php

--lonnie

And then Jeff (original poster) reported back thatn #2 worked well for him.

Mac

--
Mac Newbold			Code Greene, LLC
 				1440 S. Foothill Dr. Suite #250
Office:	801-438-0142		Salt Lake City, UT  84108
Cell:	801-694-6334		www.codegreene.com


More information about the UPHPU mailing list