24 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
59 public function __construct($a_res,$with_headers =
false,$a_type = self::RESULT_TYPE_JSON)
65 $this->result_string = $a_res;
66 $this->result_type = $a_type;
70 $this->header_parsing =
true;
85 $this->http_code = $a_code;
128 return $this->headers ? $this->headers : array();
138 if(!$this->result_string)
140 $this->result = array();
144 if($this->header_parsing)
150 switch($this->result_type)
152 case self::RESULT_TYPE_JSON:
153 $this->result = json_decode($this->result_string);
168 $pos = strpos($this->result_string,
"\r\n\r\n");
171 $this->result_header = substr($this->result_string,0,
$pos + 2);
172 $this->result_string = substr($this->result_string,
$pos + 2,-1);
177 $this->log->write(__METHOD__.
': Cannot find header entry');
191 $location_start = strpos($this->result_header,
"Location:");
192 if($location_start !==
false)
194 $location_start += 10;
195 $location_end = strpos($this->result_header,
"\r\n",$location_start);
197 $location = substr($this->result_header,$location_start,$location_end - $location_start);