| ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot |
HTTP_Request2_ResponseHTTP_Request2_Response – Class representing a HTTP response message
OverviewHTTP_Request2_Response encapsulates a HTTP response message and provides easy access to different parts of it. It also contains static helper methods HTTP_Request2_Response::decodeGzip() and HTTP_Request2_Response::decodeDeflate() for decoding response bodies encoded by Content-Encoding: gzip (as defined in RFC 1952) and Content-Encoding: deflate (RFC 1950), respectively. An instance of this class will usually be returned by HTTP_Request2::send() method. You can also build an instance yourself using either helper methods of HTTP_Request2_Adapter_Mock or manually (see below). You can use the following methods for accessing various parts of HTTP response: getStatus(), getReasonPhrase(), getVersion(), getHeader(), getCookies(), getBody(). Note that the response object will not contain the response body if 'store_body' configuration parameter was set to FALSE. Also note that getBody() always returns body completely decoded, if for some reason you want to access body still encoded by gzip / deflate you'll need to use Observers and Socket adapter. Accessing response parts
<?php
Building the Response ManuallyThe class is designed to be used in "streaming" scenario, building the response as it is being received: Building the response (pseudocode)
<?php
Everything is straightforward enough, but a few things need considering:
|
各種マニュアル:
PHPマニュアル |
PEARマニュアル |
Smarty(英語)マニュアル |
PHP-GTKマニュアル |
「HTTP_Request2_Response」をGoogle検索
|