<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The EventHttpRequest class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="eventhttpconnection.settimeout.html">EventHttpConnection::setTimeout</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventhttprequest.addheader.html">EventHttpRequest::addHeader</a></div> <div class="up"><a href="book.event.html">Event</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.eventhttprequest" class="reference"> <h1 class="title">The EventHttpRequest class</h1> <div class="partintro"><p class="verinfo">(PECL event >= 1.4.0-beta)</p> <div class="section" id="eventhttprequest.intro"> <h2 class="title">Introduction</h2> <p class="para"> Represents an HTTP request. </p> </div> <div class="section" id="eventhttprequest.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"> </div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">EventHttpRequest</strong> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-get"><var class="varname">CMD_GET</var></a></var> <span class="initializer"> = 1</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-post"><var class="varname">CMD_POST</var></a></var> <span class="initializer"> = 2</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-head"><var class="varname">CMD_HEAD</var></a></var> <span class="initializer"> = 4</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-put"><var class="varname">CMD_PUT</var></a></var> <span class="initializer"> = 8</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-delete"><var class="varname">CMD_DELETE</var></a></var> <span class="initializer"> = 16</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-options"><var class="varname">CMD_OPTIONS</var></a></var> <span class="initializer"> = 32</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-trace"><var class="varname">CMD_TRACE</var></a></var> <span class="initializer"> = 64</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-connect"><var class="varname">CMD_CONNECT</var></a></var> <span class="initializer"> = 128</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.cmd-patch"><var class="varname">CMD_PATCH</var></a></var> <span class="initializer"> = 256</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.input-header"><var class="varname">INPUT_HEADER</var></a></var> <span class="initializer"> = 1</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.eventhttprequest.html#eventhttprequest.constants.output-header"><var class="varname">OUTPUT_HEADER</var></a></var> <span class="initializer"> = 2</span> ;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="eventhttprequest.addheader.html" class="methodname">addHeader</a></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$key</code> </span> , <span class="methodparam"> <span class="type">string</span> <code class="parameter">$value</code> </span> , <span class="methodparam"> <span class="type">int</span> <code class="parameter">$type</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.cancel.html" class="methodname">cancel</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.clearheaders.html" class="methodname">clearHeaders</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.closeconnection.html" class="methodname">closeConnection</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="eventhttprequest.construct.html" class="methodname">__construct</a></span> ( <span class="methodparam"> <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code> </span> [, <span class="methodparam"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$data</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.findheader.html" class="methodname">findHeader</a></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$key</code> </span> , <span class="methodparam"> <span class="type">string</span> <code class="parameter">$type</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.free.html" class="methodname">free</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">EventBufferEvent</span> <span class="methodname"><a href="eventhttprequest.closeconnection.html" class="methodname">closeConnection</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.getcommand.html" class="methodname">getCommand</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">EventHttpConnection</span> <span class="methodname"><a href="eventhttprequest.closeconnection.html" class="methodname">closeConnection</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="eventhttprequest.gethost.html" class="methodname">getHost</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">EventBuffer</span> <span class="methodname"><a href="eventhttprequest.getinputbuffer.html" class="methodname">getInputBuffer</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="eventhttprequest.getinputheaders.html" class="methodname">getInputHeaders</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">EventBuffer</span> <span class="methodname"><a href="eventhttprequest.getoutputbuffer.html" class="methodname">getOutputBuffer</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.getoutputheaders.html" class="methodname">getOutputHeaders</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="eventhttprequest.getresponsecode.html" class="methodname">getResponseCode</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="eventhttprequest.geturi.html" class="methodname">getUri</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.removeheader.html" class="methodname">removeHeader</a></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$key</code> </span> , <span class="methodparam"> <span class="type">string</span> <code class="parameter">$type</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.senderror.html" class="methodname">sendError</a></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$error</code> </span> [, <span class="methodparam"> <span class="type">string</span> <code class="parameter">$reason</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.sendreply.html" class="methodname">sendReply</a></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$code</code> </span> , <span class="methodparam"> <span class="type">string</span> <code class="parameter">$reason</code> </span> [, <span class="methodparam"> <span class="type"><a href="class.eventbuffer.html" class="type EventBuffer">EventBuffer</a></span> <code class="parameter">$buf</code> </span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.sendreplychunk.html" class="methodname">sendReplyChunk</a></span> ( <span class="methodparam"> <span class="type"><a href="class.eventbuffer.html" class="type EventBuffer">EventBuffer</a></span> <code class="parameter">$buf</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.sendreplyend.html" class="methodname">sendReplyEnd</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="eventhttprequest.sendreplystart.html" class="methodname">sendReplyStart</a></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$code</code> </span> , <span class="methodparam"> <span class="type">string</span> <code class="parameter">$reason</code> </span> )</div> }</div> </div> <div class="section" id="eventhttprequest.constants"> <h2 class="title">Predefined Constants</h2> <dl> <dt id="eventhttprequest.constants.cmd-get"> <span class="term"> <strong><code>EventHttpRequest::CMD_GET</code></strong> </span> <dd> <p class="para"> GET method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-post"> <span class="term"> <strong><code>EventHttpRequest::CMD_POST</code></strong> </span> <dd> <p class="para"> POST method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-head"> <span class="term"> <strong><code>EventHttpRequest::CMD_HEAD</code></strong> </span> <dd> <p class="para"> HEAD method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-put"> <span class="term"> <strong><code>EventHttpRequest::CMD_PUT</code></strong> </span> <dd> <p class="para"> PUT method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-delete"> <span class="term"> <strong><code>EventHttpRequest::CMD_DELETE</code></strong> </span> <dd> <p class="para"> DELETE command(method) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-options"> <span class="term"> <strong><code>EventHttpRequest::CMD_OPTIONS</code></strong> </span> <dd> <p class="para"> OPTIONS method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-trace"> <span class="term"> <strong><code>EventHttpRequest::CMD_TRACE</code></strong> </span> <dd> <p class="para"> TRACE method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-connect"> <span class="term"> <strong><code>EventHttpRequest::CMD_CONNECT</code></strong> </span> <dd> <p class="para"> CONNECT method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.cmd-patch"> <span class="term"> <strong><code>EventHttpRequest::CMD_PATCH</code></strong> </span> <dd> <p class="para"> PATCH method(command) </p> </dd> </dt> <dt id="eventhttprequest.constants.input-header"> <span class="term"> <strong><code>EventHttpRequest::INPUT_HEADER</code></strong> </span> <dd> <p class="para"> Request input header type. </p> </dd> </dt> <dt id="eventhttprequest.constants.output-header"> <span class="term"> <strong><code>EventHttpRequest::OUTPUT_HEADER</code></strong> </span> <dd> <p class="para"> Request output header type. </p> </dd> </dt> </dl> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="eventhttprequest.addheader.html">EventHttpRequest::addHeader</a> — Adds an HTTP header to the headers of the request</li><li><a href="eventhttprequest.cancel.html">EventHttpRequest::cancel</a> — Cancels a pending HTTP request</li><li><a href="eventhttprequest.clearheaders.html">EventHttpRequest::clearHeaders</a> — Removes all output headers from the header list of the request</li><li><a href="eventhttprequest.closeconnection.html">EventHttpRequest::closeConnection</a> — Closes associated HTTP connection</li><li><a href="eventhttprequest.construct.html">EventHttpRequest::__construct</a> — Constructs EventHttpRequest object</li><li><a href="eventhttprequest.findheader.html">EventHttpRequest::findHeader</a> — Finds the value belonging a header</li><li><a href="eventhttprequest.free.html">EventHttpRequest::free</a> — Frees the object and removes associated events</li><li><a href="eventhttprequest.getbufferevent.html">EventHttpRequest::getBufferEvent</a> — Returns EventBufferEvent object</li><li><a href="eventhttprequest.getcommand.html">EventHttpRequest::getCommand</a> — Returns the request command(method)</li><li><a href="eventhttprequest.getconnection.html">EventHttpRequest::getConnection</a> — Returns EventHttpConnection object</li><li><a href="eventhttprequest.gethost.html">EventHttpRequest::getHost</a> — Returns the request host</li><li><a href="eventhttprequest.getinputbuffer.html">EventHttpRequest::getInputBuffer</a> — Returns the input buffer</li><li><a href="eventhttprequest.getinputheaders.html">EventHttpRequest::getInputHeaders</a> — Returns associative array of the input headers</li><li><a href="eventhttprequest.getoutputbuffer.html">EventHttpRequest::getOutputBuffer</a> — Returns the output buffer of the request</li><li><a href="eventhttprequest.getoutputheaders.html">EventHttpRequest::getOutputHeaders</a> — Returns associative array of the input headers</li><li><a href="eventhttprequest.getresponsecode.html">EventHttpRequest::getResponseCode</a> — Returns the the response code</li><li><a href="eventhttprequest.geturi.html">EventHttpRequest::getUri</a> — Returns the request URI</li><li><a href="eventhttprequest.removeheader.html">EventHttpRequest::removeHeader</a> — Removes an HTTP header from the headers of the request</li><li><a href="eventhttprequest.senderror.html">EventHttpRequest::sendError</a> — Send an HTML error message to the client</li><li><a href="eventhttprequest.sendreply.html">EventHttpRequest::sendReply</a> — Send an HTML reply to the client</li><li><a href="eventhttprequest.sendreplychunk.html">EventHttpRequest::sendReplyChunk</a> — Send another data chunk as part of an ongoing chunked reply</li><li><a href="eventhttprequest.sendreplyend.html">EventHttpRequest::sendReplyEnd</a> — Complete a chunked reply, freeing the request as appropriate</li><li><a href="eventhttprequest.sendreplystart.html">EventHttpRequest::sendReplyStart</a> — Initiate a chunked reply</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="eventhttpconnection.settimeout.html">EventHttpConnection::setTimeout</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventhttprequest.addheader.html">EventHttpRequest::addHeader</a></div> <div class="up"><a href="book.event.html">Event</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>