24 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
60 public function __construct($a_res,$with_headers =
false,$a_type = self::RESULT_TYPE_JSON)
66 $this->result_string = $a_res;
67 $this->result_type = $a_type;
71 $this->header_parsing =
true;
86 $this->http_code = $a_code;
128 $this->headers = $a_headers;
138 return $this->headers ? $this->headers : array();
148 if(!$this->result_string)
150 $this->result = array();
154 if($this->header_parsing)
160 switch($this->result_type)
162 case self::RESULT_TYPE_JSON:
163 $this->result = json_decode($this->result_string);
166 case self::RESULT_TYPE_URL_LIST:
167 $this->result = $this->
parseUriList($this->result_string);
182 $pos = strpos($this->result_string,
"\r\n\r\n");
185 $this->result_header = substr($this->result_string,0,$pos + 2);
186 $this->result_string = substr($this->result_string,$pos + 2,-1);
191 $this->log->write(__METHOD__.
': Cannot find header entry');
205 $location_start = strpos($this->result_header,
"Location:");
206 if($location_start !==
false)
208 $location_start += 10;
209 $location_end = strpos($this->result_header,
"\r\n",$location_start);
211 $location = substr($this->result_header,$location_start,$location_end - $location_start);
224 include_once
'Services/WebServices/ECS/classes/class.ilECSUriList.php';
227 foreach($lines as $line)
234 $uri_parts = explode(
"/", $line);
235 $list->add($line, array_pop($uri_parts));