LV. HTTP

Introduction

This HTTP extension aims to provide a convenient and powerful set of functionality for one of PHPs major applications.

It eases handling of HTTP URLs, dates, redirects, headers and messages, provides means for negotiation of clients preferred language and charset, as well as a convenient way to send any arbitrary data with caching and resuming capabilities.

It provides powerful request functionality, if built with CURL support. Parallel requests are available for PHP 5 and greater.

Additionally to the API reference in this manual you can find information about how to install and configure as well as which global constants are predefined in the following sections:

Installation
Configuration
Global Constants
Resource Types

Classes

The classes below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

The HttpResponse class requires at least PHP v5.1. Any other class is available as of PHP v5.0.

Note: Be aware though, that some methods are not available with PHP v5.0.

HttpMessage
HttpQueryString
HttpDeflateStream
HttpInflateStream
HttpRequest
HttpRequestPool
HttpResponse

Table of Contents
Installation -- Installing the HTTP extension
Configuration -- http module configuration directives
Resources -- Resources created by the HTTP extension
Constants -- predefined http module constants
Request Options -- options usable with the HttpRequest class and request functions
HttpMessage -- HTTP Message Class
HttpMessage::__construct -- HttpMessage constructor
HttpMessage::factory -- Create HttpMessage from string
HttpMessage::fromEnv -- Create HttpMessage from environment
HttpMessage::fromString -- Create HttpMessage from string
HttpMessage::toString -- Get string representation
HttpMessage::toMessageTypeObject -- Create HTTP object regarding message type
HttpMessage::guessContentType -- Guess content type
HttpMessage::detach -- Detach HttpMessage
HttpMessage::prepend -- Prepend message(s)
HttpMessage::reverse -- Reverse message chain
HttpMessage::send -- Send message
HttpMessage::getParentMessage -- Get parent message
HttpMessage::getType -- Get message type
HttpMessage::setType -- Set message type
HttpMessage::getHttpVersion -- Get HTTP version
HttpMessage::setHttpVersion -- Set HTTP version
HttpMessage::getHeaders -- Get message headers
HttpMessage::getHeader -- Get header
HttpMessage::addHeaders -- Add headers
HttpMessage::setHeaders -- Set headers
HttpMessage::getBody -- Get message body
HttpMessage::setBody -- Set message body
HttpMessage::getRequestMethod -- Get request method
HttpMessage::setRequestMethod -- Set request method
HttpMessage::getRequestUrl -- Get request URL
HttpMessage::setRequestUrl -- Set request URL
HttpMessage::getResponseCode -- Get response code
HttpMessage::setResponseCode -- Set response code
HttpMessage::getResponseStatus -- Get response status
HttpMessage::setResponseStatus -- Set response status
HttpQueryString -- HTTP Query String Class
HttpQueryString::__construct -- HttpQueryString constructor
HttpQueryString::singleton -- HttpQueryString singleton
HttpQueryString::get -- Get (part of) query string
HttpQueryString::mod -- Modifiy query string copy
HttpQueryString::set -- Set query string params
HttpQueryString::toArray -- Get query string as array
HttpQueryString::toString -- Get query string
HttpQueryString::xlate -- Change query strings charset
HttpDeflateStream -- HTTP Deflate Stream Class
HttpDeflateStream::factory -- HttpDeflateStream class factory
HttpDeflateStream::__construct -- HttpDeflateStream class constructor
HttpDeflateStream::update -- Update deflate stream
HttpDeflateStream::flush -- Flush deflate stream
HttpDeflateStream::finish -- Finalize deflate stream
HttpInflateStream -- HTTP Inflate Stream
HttpInflateStream::factory -- HttpInflateStream class factory
HttpInflateStream::__construct -- HttpInflateStream class constructor
HttpInflateStream::update -- Update inflate stream
HttpInflateStream::flush -- Flush inflate stream
HttpInflateStream::finish -- Finalize inflate stream
HttpRequest -- HTTP Request Class
HttpRequest::addCookies -- Add cookies
HttpRequest::addHeaders -- Add headers
HttpRequest::addPostFields -- Add post fields
HttpRequest::addPostFile -- Add post file
HttpRequest::addPutData -- Add put data
HttpRequest::addQueryData -- Add query data
HttpRequest::addRawPostData -- Add raw post data
HttpRequest::addSslOptions -- Add ssl options
HttpRequest::clearHistory -- Clear history
HttpRequest::__construct -- HttpRequest constructor
HttpRequest::enableCookies -- Enable cookies
HttpRequest::getContentType -- Get content type
HttpRequest::getCookies -- Get cookies
HttpRequest::getHeaders -- Get headers
HttpRequest::getHistory -- Get history
HttpRequest::getMethod -- Get method
HttpRequest::getOptions -- Get options
HttpRequest::getPostFields -- Get post fields
HttpRequest::getPostFiles -- Get post files
HttpRequest::getPutData -- Get put data
HttpRequest::getPutFile -- Get put file
HttpRequest::getQueryData -- Get query data
HttpRequest::getRawPostData -- Get raw post data
HttpRequest::getRawRequestMessage -- Get raw request message
HttpRequest::getRawResponseMessage -- Get raw response message
HttpRequest::getRequestMessage -- Get request message
HttpRequest::getResponseBody -- Get response body
HttpRequest::getResponseCode -- Get response code
HttpRequest::getResponseCookies -- Get response cookie(s)
HttpRequest::getResponseData -- Get response data
HttpRequest::getResponseHeader -- Get response header(s)
HttpRequest::getResponseInfo -- Get response info
HttpRequest::getResponseMessage -- Get response message
HttpRequest::getResponseStatus -- Get response status
HttpRequest::getSslOptions -- Get ssl options
HttpRequest::getUrl -- Get url
HttpRequest::resetCookies -- Reset cookies
HttpRequest::send -- Send request
HttpRequest::setContentType -- Set content type
HttpRequest::setCookies -- Set cookies
HttpRequest::setHeaders -- Set headers
HttpRequest::setMethod -- Set method
HttpRequest::setOptions -- Set options
HttpRequest::setPostFields -- Set post fields
HttpRequest::setPostFiles -- Set post files
HttpRequest::setPutData -- Set put data
HttpRequest::setPutFile -- Set put file
HttpRequest::setQueryData -- Set query data
HttpRequest::setRawPostData -- Set raw post data
HttpRequest::setSslOptions -- Set ssl options
HttpRequest::setUrl -- Set URL
HttpRequestPool -- HTTP Request Pool Class
HttpRequestPool::attach -- Attach HttpRequest
HttpRequestPool::__construct -- HttpRequestPool constructor
HttpRequestPool::__destruct -- HttpRequestPool destructor
HttpRequestPool::detach -- Detach HttpRequest
HttpRequestPool::getAttachedRequests -- Get attached requests
HttpRequestPool::getFinishedRequests -- Get finished requests
HttpRequestPool::reset -- Reset request pool
HttpRequestPool::send -- Send all requests
HttpRequestPool::socketPerform -- Perform socket actions
HttpRequestPool::socketSelect -- Perform socket select
HttpResponse -- HTTP Response Class
HttpResponse::capture -- Capture script output
HttpResponse::getBufferSize -- Get buffer size
HttpResponse::getCacheControl -- Get cache control
HttpResponse::getCache -- Get cache
HttpResponse::getContentDisposition -- Get content disposition
HttpResponse::getContentType -- Get content type
HttpResponse::getData -- Get data
HttpResponse::getETag -- Get ETag
HttpResponse::getFile -- Get file
HttpResponse::getGzip -- Get gzip
HttpResponse::getHeader -- Get header
HttpResponse::getLastModified -- Get last modified
HttpResponse::getStream -- Get Stream
HttpResponse::getThrottleDelay -- Get throttle delay
HttpResponse::getRequestBody -- Get request body
HttpResponse::getRequestBodyStream -- Get request body stream
HttpResponse::getRequestHeaders -- Get request headers
HttpResponse::guessContentType -- Guess content type
HttpResponse::redirect -- Redirect
HttpResponse::send -- Send response
HttpResponse::setBufferSize -- Set buffer size
HttpResponse::setCacheControl -- Set cache control
HttpResponse::setCache -- Set cache
HttpResponse::setContentDisposition -- Set content disposition
HttpResponse::setContentType -- Set content type
HttpResponse::setData -- Set data
HttpResponse::setETag -- Set ETag
HttpResponse::setFile -- Set file
HttpResponse::setGzip -- Set gzip
HttpResponse::setHeader -- Set header
HttpResponse::setLastModified -- Set last modified
HttpResponse::setStream -- Set stream
HttpResponse::setThrottleDelay -- Set throttle delay
HttpResponse::status -- Send HTTP response status
http_cache_etag -- Caching by ETag
http_cache_last_modified -- Caching by last modification
http_chunked_decode -- Decode chunked-encoded data
http_deflate -- Deflate data
http_inflate -- Inflate data
http_get_request_body_stream -- Get request body as stream
http_get_request_body -- Get request body as string
http_get_request_headers -- Get request headers as array
http_date -- Compose HTTP RFC compliant date
http_support -- Check built-in HTTP support
http_match_etag -- Match ETag
http_match_modified -- Match last modification
http_match_request_header -- Match any header
http_build_cookie -- Build cookie string
http_negotiate_charset -- Negotiate clients preferred character set
http_negotiate_content_type -- Negotiate clients preferred content type
http_negotiate_language -- Negotiate clients preferred language
ob_deflatehandler -- Deflate output handler
ob_etaghandler -- ETag output handler
ob_inflatehandler -- Inflate output handler
http_parse_cookie -- Parse HTTP cookie
http_parse_headers -- Parse HTTP headers
http_parse_message -- Parse HTTP messages
http_parse_params -- Parse parameter list
http_persistent_handles_count -- Stat persistent handles
http_persistent_handles_ident -- Get/set ident of persistent handles
http_persistent_handles_clean -- Clean up persistent handles
http_get -- Perform GET request
http_head -- Perform HEAD request
http_post_data -- Perform POST request with pre-encoded data
http_post_fields -- Perform POST request with data to be encoded
http_put_data -- Perform PUT request with data
http_put_file -- Perform PUT request with file
http_put_stream -- Perform PUT request with stream
http_request_method_exists -- Check whether request method exists
http_request_method_name -- Get request method name
http_request_method_register -- Register request method
http_request_method_unregister -- Unregister request method
http_request -- Perform custom request
http_request_body_encode -- Encode request body
http_redirect -- Issue HTTP redirect
http_send_content_disposition -- Send Content-Disposition
http_send_content_type -- Send Content-Type
http_send_data -- Send arbitrary data
http_send_file -- Send file
http_send_last_modified -- Send Last-Modified
http_send_status -- Send HTTP response status
http_send_stream -- Send stream
http_throttle -- HTTP throttling
http_build_str -- Build query string
http_build_url -- Build an URL