PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

Configuration | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

Configuration

Configuration – Configuration parameters for HTTP_Request2

List of Configuration Parameters

HTTP_Request2 constructor and HTTP_Request2::setConfig() method accept the following configuration parameters. You can also use HTTP_Request2::getConfig() to get the values of these parameters. Note that using an unknown parameter name will result in an exception.

Common parameters
Parameter name Description Expected type Default value
adapter Adapter to use, may also be set by HTTP_Request2::setAdapter() method. (See: Adapters) string|object 'HTTP_Request2_Adapter_Socket'
connect_timeout Connection timeout in seconds. Exception will be thrown if connecting to remote host takes more than this number of seconds. integer 10
timeout Total number of seconds a request can take. Use 0 for no limit, should be greater than connect_timeout if set. Exception will be thrown if execution of HTTP_Request2::send() takes more than this number of seconds. integer 0
use_brackets Whether to append [] to array variable names. This is useful when performing a request to a remote PHP page which expects array parameters to have brackets, should be turned off in the other cases. boolean TRUE
protocol_version HTTP protocol version to use, '1.0' or '1.1' string '1.1'
buffer_size Buffer size to use for reading and writing. Leave this at the default unless you know what you are doing. integer 16384
store_body Whether to store response body in response object. Set to false if receiving a huge response and using an Observer to save it. (See: Observers) boolean TRUE
digest_compat_ie Whether to imitate behaviour of MSIE 5 and 6 in using URL without query string in digest authentication boolean FALSE

Redirect parameters
Parameter name Description Expected type Default value
follow_redirects Whether to automatically follow HTTP redirects in server response boolean FALSE
max_redirects Maximum number of redirects to follow integer 5
strict_redirects Whether to keep request method on redirects via status 301 and 302 (TRUE, needed for compatibility with RFC 2616) or switch to GET (FALSE, needed for compatibility with most browsers). Issues with Curl Adapter boolean FALSE

Proxy parameters
Parameter name Description Expected type Default value
proxy_host Proxy server host string ''
proxy_port Proxy server port integer ''
proxy_user User name for proxy authentication string ''
proxy_password Password for proxy authentication string ''
proxy_auth_scheme Proxy authentication scheme, one of HTTP_Request2::AUTH_* constants string HTTP_Request2::AUTH_BASIC

SSL parameters
Parameter name Description Expected type Default value
ssl_verify_peer Whether to verify peer's SSL certificate. Note that this is on by default, to follow the behaviour of modern browsers and current cURL version. Issues with Socket Adapter. boolean TRUE
ssl_verify_host Whether to check that Common Name in SSL certificate matches host name. Issues with Socket Adapter. boolean TRUE
ssl_cafile Certificate Authority file to verify the peer with (use when ssl_verify_peer is TRUE) string NULL
ssl_capath Directory holding multiple Certificate Authority files string NULL
ssl_local_cert Name of a file containing local certificate string NULL
ssl_passphrase Passphrase with which local certificate was encoded string NULL

Proxy Configuration

While most of the configuration parameters have sane default values and generally can be left alone, you'll definitely need to configure proxy you are using to access websites.

Proxy configuration example

<?php
require_once 'HTTP/Request2.php';

$request = new HTTP_Request2();
$request->setConfig(array(
    
'proxy_host'        => 'proxy.example.com',
    
'proxy_port'        => 3128,
    
'proxy_user'        => 'luser',
    
'proxy_password'    => 'sekret',
    
'proxy_auth_scheme' => HTTP_Request2::AUTH_DIGEST
));

// Now you can perform requests
?>
忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「Configuration」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | Configuration」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: