24 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
63 public function __construct($a_res,$with_headers =
false,$a_type = self::RESULT_TYPE_JSON)
69 $this->result_string = $a_res;
70 $this->result_type = $a_type;
74 $this->header_parsing =
true;
89 $this->http_code = $a_code;
131 $this->headers = $a_headers;
141 return $this->headers ? $this->headers : array();
151 if($this->header_parsing and $this->result_string)
158 switch($this->result_type)
160 case self::RESULT_TYPE_JSON:
161 if($this->result_string)
163 $this->result = json_decode($this->result_string);
167 $this->result = array();
171 case self::RESULT_TYPE_URL_LIST:
172 $this->result = $this->
parseUriList($this->result_string);
187 $pos = strpos($this->result_string,
"\r\n\r\n");
190 $this->result_header = substr($this->result_string,0,$pos + 2);
191 $this->result_string = substr($this->result_string,$pos + 2,-1);
196 $this->log->write(__METHOD__.
': Cannot find header entry');
210 $location_start = strpos($this->result_header,
"Location:");
211 if($location_start !==
false)
213 $location_start += 10;
214 $location_end = strpos($this->result_header,
"\r\n",$location_start);
216 $location = substr($this->result_header,$location_start,$location_end - $location_start);
220 $ecs_sender = strpos($this->result_header,self::HEADER_ECS_SENDER);
221 if($ecs_sender !==
false)
224 $sender_end = strpos($this->result_header,
"\r\n",$sender_start);
225 $sender = substr($this->result_header,$sender_start,$sender_end - $sender_start);
227 $senders_arr = explode(
',',$sender);
240 include_once
'Services/WebServices/ECS/classes/class.ilECSUriList.php';
243 foreach($lines as $line)
250 $uri_parts = explode(
"/", $line);
251 $list->add($line, array_pop($uri_parts));