News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Nicolas Grekas (on Github):
Improved handling of HTTP requests in PHP
June 17, 2011 @ 09:39:41

As Nicolas Grekas shows in this tutorial (posted as a gist), the functionality that PHP gives users to work with the raw HTTP requests is pretty limited. There's a few solutions he offers, but none of them allow for the full use of the HTTP options provided by the server.

HP offers comprehensive autoglobals to access external data sent with each request. These variables do not expose all the possibilities allowed by the HTTP protocol, but a controlled use can in practice minimize the impact of this limitation. Two problems are particularly troublesome: the lack of access to multi-valued keys without using a special syntax and complexity of the magic bracketed syntax. Until PHP natively provides another interface freed from these problems, a different interface in user space can circumvent them.

He gives some code examples of methods that can be used to parse strings like those found in cookies (or pulled in via php://stdin) including mentions of key normalization and accessing the values by literal keys. You can see a more full implementation here.

0 comments voice your opinion now!
http handling improved requests tutorial parse


blog comments powered by Disqus

Similar Posts

PHPMaster.com: Using the Last.fm API

Lars Strojny's Blog: Dependency Injection Container Refactorings, Part Two

SitePoint PHP Blog: Using Github Webhooks with PHP

Tim Koschuetzki's Blog: How To Transform HTML To Textile Markup - The CakePHP TextileHelper Revisite

PHPBuilder.com: Add NoSQL Data Storage to Your PHP Development with Redis


Community Events

Don't see your event here?
Let us know!


interview laravel release voicesoftheelephpant php7 application podcast example symfony2 configure community series framework conference api introduction opinion performance library install

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework