Wez have a new post on his blog on HTTP post from PHP without Curl. The code is using fopen() mixed with stream_context_create() to make post request, then stream_get_contents() to retrieve data. Headers are optional but if not set, Content-Type will be set automatically to application/x-www-form-urlencoded. Wez suggested also to look at the http_build_query() to assemble query/post parameters from a PHP vars.

I don’t think we do a very good job of evangelizing some of the nice things that the PHP streams layer does in the PHP manual, or even in general. At least, every time I search for the code snippet that allows you to do an HTTP POST request, I don’t find it in the manual and resort to reading the source. (You can find it if you search for “HTTP wrapper” in the online documentation, but that’s not really what you think you’re searching for when you’re looking).