PHP Classes

File: HttpFsockopen/Response.php

Recommend this page to a friend!
  Classes of Afif Ahmad Hidayat   PHP HTTP fsockopen   HttpFsockopen/Response.php   Download  
File: HttpFsockopen/Response.php
Role: Class source
Content type: text/plain
Description: response class
Class: PHP HTTP fsockopen
Send HTTP requests using socket connections
Author: By
Last change:
Date: 8 years ago
Size: 949 bytes
 

Contents

Class file image Download
<?php

/*
justin was here :D
*/

class HttpFsockopen_Response {
   
    protected
$socket;
    protected
$errno;
    protected
$errstr;
   
    public function
__construct($socket, $contents, $errno, $errstr){
       
$this -> socket = $socket;
       
$this -> errno = $errno;
       
$this -> errstr = $errstr;
        if(
$errno == 0){
           
$limiter = strpos($contents,"\r\n\r\n");
           
$headerStr = substr($contents, 0, $limiter);
           
$this -> body = substr($contents, $limiter+3);
           
$this -> header = new HttpFsockopen_Header($headerStr);
        } else {
           
$this -> body = $contents;
           
$this -> header = new HttpFsockopen_Header("");
        }
    }
   
    public function
getContent(){
        return
$this -> body;
    }
   
    public function
getHeader(){
        return
$this -> header;
    }
   
    public function
getSocket(){
        return
$this -> socket;
    }
   
    public function
getErrno(){
        return
$this -> errno;
    }
   
    public function
getErrstr(){
        return
$this -> errstr;
    }
}