Module_HttpClient_Result::__construct
null Module_HttpClient_Result::__construct( )
File: ./modules/httpclient/result.class.php
public function __construct($data)
{
if ( isset($data['code']) ) $this->code = $data['code'];
if ( isset($data['time']) ) $this->time = $data['time'];
if ( isset($data['data']) ) $this->data = $data['data'];
if ( isset($data['header']) && is_array($data['header']) ) foreach ( $data['header'] as $item )
{
if ( preg_match('#^([a-zA-Z0-9\-]+): (.*)$#', $item, $m) )
{
if ( $m[1] == 'Set-Cookie' )
{
if ( preg_match('#^([a-zA-Z0-9\-_]+)=(.*)$#', $m[2], $m2) )
{
$this->cookies[$m2[1]] = $m2[2];
}
}
else
{
$this->headers[$m[1]] = $m[2];
}
}
}
}