NYCPHP Meetup

NYPHP.org

[nycphp-talk] PECL extension how to question

csnyder chsnyder at gmail.com
Fri Oct 6 19:10:37 EDT 2006


On 10/4/06, Timothy Boyden <tboyden at supercoups.com> wrote:

> So I have begun to step into the programming
> problem and am stuck on how to replicate the Java HttpRequest and
> HttpResponse mechanisms in a PHP way. My first thoughts were to do this
> using the PECL HTTP extension and use the HttpRequest and HttpResponse
> classes, however I've never coded in an object-oriented fashion and can't
> seem to figure out how to use the PECL HTTP extension. But perhaps I'm going
> in the wrong direction with how to approach this?


At the risk of telling you what you already know, the standard "PHP
way" is to use the $_SERVER, $_GET, and/or $_POST superglobals to
obtain whatever information you need about the request. These are
automatically created when the webserver passes the request to PHP.

PHP sets a few HTTP response headers automatically, which can be
supplemented or overwritten using the header() function. The response
body is simply the output of your script. There is an output buffering
mechanism that can give you control over this. Anything outside of
<?php ... ?> tags will also be part of the response.

Sorry, this may be way too simple an answer, but I can't tell from
your post whether you're new to PHP or if there's some advanced
functionality you're trying to get at.

-- 
Chris Snyder
http://chxo.com/



More information about the talk mailing list