コード例 #1
0
ファイル: HttpResponse.php プロジェクト: koolkode/http
 /**
  * Create a new HTTP response.
  * 
  * @param integer $status HTTP status code.
  * @param string $reason
  * @param string $protocol
  */
 public function __construct($status = Http::CODE_OK, $reason = '', $protocol = 'HTTP/1.1')
 {
     parent::__construct($protocol);
     $this->setStatus($status);
     $this->setReason($reason);
     if ($this->reason == '') {
         $this->reason = Http::getReason($this->status, $this->reason);
     }
     $this->setHeader('Date', gmdate(Http::DATE_FORMAT_RFC1123, time()));
 }
コード例 #2
0
ファイル: HttpRequest.php プロジェクト: koolkode/http
 /**
  * Create a new HTTP request.
  * 
  * @param mixed $uri The absolute URI that has been requested.
  * @param string $method The HTTP request method being used.
  * @param string $protocol The HTTP protocol version being used.
  */
 public function __construct($uri, $method = Http::METHOD_GET, $protocol = 'HTTP/1.1')
 {
     parent::__construct($protocol);
     $this->uri = new Uri($uri);
     $this->rawUri = '/' . (string) $this->uri->getPath();
     if (count($this->uri->getQuery())) {
         $this->rawUri .= '?' . $this->uri->getQueryString();
     }
     $this->setMethod($method);
     $this->setHeader('Host', $uri->getHost(true));
     $this->setHeader('Connection', 'close');
 }