HTTP
PHP 手册

预定义常量

以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。

Constants usable with http_support()
HTTP_SUPPORT (integer)
querying for this constant will always return TRUE
HTTP_SUPPORT_REQUESTS (integer)
whether support to issue HTTP requests is given, ie. libcurl support was compiled in
HTTP_SUPPORT_MAGICMIME (integer)
whether support to guess the Content-Type of HTTP messages is given, ie. libmagic support was compiled in
HTTP_SUPPORT_ENCODINGS (integer)
whether support for zlib encodings is given, ie. libz support was compiled in
HTTP_SUPPORT_SSLREQUESTS (integer)
whether support to issue HTTP requests over SSL is given, ie. linked libcurl was built with SSL support
Constants usable with http_parse_params()
HTTP_PARAMS_ALLOW_COMMA (integer)
allow commands additionally to semicolons as separator
HTTP_PARAMS_ALLOW_FAILURE (integer)
continue parsing after an error occurred
HTTP_PARAMS_RAISE_ERROR (integer)
raise PHP warnings on parse errors
HTTP_PARAMS_DEFAULT (integer)
all three values above, bitwise or'ed
Constants usable with http_parse_cookie() and its return value
HTTP_COOKIE_PARSE_RAW (integer)
don't urldecode values
HTTP_COOKIE_SECURE (integer)
whether "secure" was found in the cookie's parameters list
HTTP_COOKIE_HTTPONLY (integer)
whether "httpOnly" was found in the cookie's parameter list
Constants usable with http_deflate() and HttpDeflateStream
HTTP_DEFLATE_LEVEL_DEF (integer)
HTTP_DEFLATE_LEVEL_MIN (integer)
HTTP_DEFLATE_LEVEL_MAX (integer)
HTTP_DEFLATE_TYPE_ZLIB (integer)
HTTP_DEFLATE_TYPE_GZIP (integer)
HTTP_DEFLATE_TYPE_RAW (integer)
HTTP_DEFLATE_STRATEGY_DEF (integer)
HTTP_DEFLATE_STRATEGY_FILT (integer)
HTTP_DEFLATE_STRATEGY_HUFF (integer)
HTTP_DEFLATE_STRATEGY_RLE (integer)
HTTP_DEFLATE_STRATEGY_FIXED (integer)
Constants usable with HttpDeflateStream and HttpInflateStream
HTTP_ENCODING_STREAM_FLUSH_NONE (integer)
don't flush
HTTP_ENCODING_STREAM_FLUSH_SYNC (integer)
synchronized flush only
HTTP_ENCODING_STREAM_FLUSH_FULL (integer)
full data flush
Constants used for error reporting and Exceptions
HTTP_E_RUNTIME (integer)
runtime error
HTTP_E_INVALID_PARAM (integer)
an invalid parameter was passed
HTTP_E_HEADER (integer)
header() or similar operation failed
HTTP_E_MALFORMED_HEADERS (integer)
HTTP header parse error
HTTP_E_REQUEST_METHOD (integer)
unknown/invalid request method
HTTP_E_MESSAGE_TYPE (integer)
with operation incompatible message type
HTTP_E_ENCODING (integer)
encoding/decoding error
HTTP_E_REQUEST (integer)
request failure
HTTP_E_REQUEST_POOL (integer)
request pool failure
HTTP_E_SOCKET (integer)
socket exception
HTTP_E_RESPONSE (integer)
response failure
HTTP_E_URL (integer)
invalid URL
HTTP_E_QUERYSTRING (integer)
querystring operation failure
Constants usable with HttpMessage
HTTP_MSG_NONE (integer)
the message is of no specific type
HTTP_MSG_REQUEST (integer)
request style message
HTTP_MSG_RESPONSE (integer)
response style message
Constants usable with HttpQueryString
HTTP_QUERYSTRING_TYPE_BOOL (integer)
HTTP_QUERYSTRING_TYPE_INT (integer)
HTTP_QUERYSTRING_TYPE_FLOAT (integer)
HTTP_QUERYSTRING_TYPE_STRING (integer)
HTTP_QUERYSTRING_TYPE_ARRAY (integer)
HTTP_QUERYSTRING_TYPE_OBJECT (integer)
Constants used for the httpauthtype request option
HTTP_AUTH_BASIC (integer)
use "basic" authentication
HTTP_AUTH_DIGEST (integer)
use "digest" authentication
HTTP_AUTH_NTLM (integer)
use "NTLM" authentication
HTTP_AUTH_GSSNEG (integer)
use "GSS-NEGOTIATE" authentication
HTTP_AUTH_ANY (integer)
try any authentication scheme
Constants used for the HTTP protocol version request option
HTTP_VERSION_ANY (integer)
no specific HTTP protocol version
HTTP_VERSION_1_0 (integer)
HTTP version 1.0
HTTP_VERSION_1_1 (integer)
HTTP version 1.1
Constants used for the SSL protocol type and version request option
HTTP_SSL_VERSION_ANY (integer)
no specific SSL protocol version
HTTP_SSL_VERSION_TLSv1 (integer)
use TLSv1 only
HTTP_SSL_VERSION_SSLv3 (integer)
use SSLv3 only
HTTP_SSL_VERSION_SSLv2 (integer)
use SSLv2 only
Constants used for the proxytype request option
HTTP_PROXY_SOCKS4 (integer)
the proxy is a SOCKS4 type proxy
HTTP_PROXY_SOCKS5 (integer)
the proxy is a SOCKS5 type proxy
HTTP_PROXY_HTTP (integer)
standard HTTP proxy
Constants used for the ipresolve request option
HTTP_IPRESOLVE_V4 (integer)
use IPv4 only for name lookups
HTTP_IPRESOLVE_V6 (integer)
use IPv6 only for name lookups
HTTP_IPRESOLVE_ANY (integer)
use any IP mechanism only for name lookups
Predefined HTTP request method constants
HTTP_METH_GET (integer)
HTTP_METH_HEAD (integer)
HTTP_METH_POST (integer)
HTTP_METH_PUT (integer)
HTTP_METH_DELETE (integer)
HTTP_METH_OPTIONS (integer)
HTTP_METH_TRACE (integer)
HTTP_METH_CONNECT (integer)
HTTP_METH_PROPFIND (integer)
HTTP_METH_PROPPATCH (integer)
HTTP_METH_MKCOL (integer)
HTTP_METH_COPY (integer)
HTTP_METH_MOVE (integer)
HTTP_METH_LOCK (integer)
HTTP_METH_UNLOCK (integer)
HTTP_METH_VERSION_CONTROL (integer)
HTTP_METH_REPORT (integer)
HTTP_METH_CHECKOUT (integer)
HTTP_METH_CHECKIN (integer)
HTTP_METH_UNCHECKOUT (integer)
HTTP_METH_MKWORKSPACE (integer)
HTTP_METH_UPDATE (integer)
HTTP_METH_LABEL (integer)
HTTP_METH_MERGE (integer)
HTTP_METH_BASELINE_CONTROL (integer)
HTTP_METH_MKACTIVITY (integer)
HTTP_METH_ACL (integer)
Constants usable with http_redirect()
HTTP_REDIRECT (integer)
guess applicable redirect method
HTTP_REDIRECT_PERM (integer)
permanent redirect (301 Moved permanently)
HTTP_REDIRECT_FOUND (integer)
standard redirect (302 Found)

Note: RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear which kind of reaction is expected of the client.

HTTP_REDIRECT_POST (integer)
redirect applicable to POST requests (303 See other)
HTTP_REDIRECT_PROXY (integer)
proxy redirect (305 Use proxy)
HTTP_REDIRECT_TEMP (integer)
temporary redirect (307 Temporary Redirect)
Constants usable with http_build_url()
HTTP_URL_REPLACE (integer)
replace every part of the first URL when there's one of the second URL
HTTP_URL_JOIN_PATH (integer)
join relative paths
HTTP_URL_JOIN_QUERY (integer)
join query strings
HTTP_URL_STRIP_USER (integer)
strip any user authentication information
HTTP_URL_STRIP_PASS (integer)
strip any password authentication information
HTTP_URL_STRIP_AUTH (integer)
strip any authentication information
HTTP_URL_STRIP_PORT (integer)
strip explicit port numbers
HTTP_URL_STRIP_PATH (integer)
strip complete path
HTTP_URL_STRIP_QUERY (integer)
strip query string
HTTP_URL_STRIP_FRAGMENT (integer)
strip any fragments (#identifier)
HTTP_URL_STRIP_ALL (integer)
strip anything but scheme and host

HTTP
PHP 手册