ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilECSConnector Class Reference
+ Inheritance diagram for ilECSConnector:
+ Collaboration diagram for ilECSConnector:

Public Member Functions

 __construct (ilECSSetting $settings=null)
 Constructor. More...
 
 addHeader ($a_name, $a_value)
 Add Header. More...
 
 getHeader ()
 
 setHeader ($a_header_strings)
 
 getServer ()
 Get current server setting. More...
 
 addAuth ($a_post, $a_target_mid)
 Add auth resource. More...
 
 getAuth ($a_hash, $a_details_only=false)
 get auth resource More...
 
 getEventQueues ()
 get event queue More...
 
 readEventFifo ($a_delete=false)
 Read event fifo. More...
 
 getResourceList ($a_path)
 
 getResource ($a_path, $a_econtent_id, $a_details_only=false)
 Get resources from ECS server. More...
 
 addResource ($a_path, $a_post)
 Add resource. More...
 
 updateResource ($a_path, $a_econtent_id, $a_post_string)
 update resource More...
 
 deleteResource ($a_path, $a_econtent_id)
 Delete resource. More...
 
 getMemberships ($a_mid=0)
 public More...
 

Data Fields

const HTTP_CODE_CREATED = 201
 
const HTTP_CODE_OK = 200
 
const HTTP_CODE_NOT_FOUND = 404
 
const HEADER_MEMBERSHIPS = 'X-EcsReceiverMemberships'
 
const HEADER_COMMUNITIES = 'X-EcsReceiverCommunities'
 

Protected Member Functions

 prepareConnection ()
 prepare connection More...
 
 call ()
 call peer More...
 

Static Protected Member Functions

static _fetchEContentIdFromHeader ($a_header)
 fetch new econtent id from location header More...
 

Protected Attributes

 $path_postfix = ''
 
 $settings
 
 $header_strings = array()
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 38 of file class.ilECSConnector.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSConnector::__construct ( ilECSSetting  $settings = null)

Constructor.

public

Parameters

Definition at line 61 of file class.ilECSConnector.php.

References $GLOBALS, $settings, and settings().

62  {
63  if ($settings) {
64  $this->settings = $settings;
65  } else {
66  $GLOBALS['ilLog']->write(__METHOD__ . ': Using deprecated call');
67  $GLOBALS['ilLog']->logStack();
68  }
69  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ _fetchEContentIdFromHeader()

static ilECSConnector::_fetchEContentIdFromHeader (   $a_header)
staticprotected

fetch new econtent id from location header

public

Parameters
arrayheader array

Definition at line 610 of file class.ilECSConnector.php.

References $ilLog.

611  {
612  global $ilLog;
613 
614  if (!isset($a_header['Location'])) {
615  return false;
616  }
617  $end_path = strrpos($a_header['Location'], "/");
618 
619  if ($end_path === false) {
620  $ilLog->write(__METHOD__ . ': Cannot find path seperator.');
621  return false;
622  }
623  $econtent_id = substr($a_header['Location'], $end_path + 1);
624  $ilLog->write(__METHOD__ . ': Received EContentId ' . $econtent_id);
625  return (int) $econtent_id;
626  }

◆ addAuth()

ilECSConnector::addAuth (   $a_post,
  $a_target_mid 
)

Add auth resource.

public

Parameters
stringpost data
Returns
int new econtent id
Exceptions
ilECSConnectorException

Definition at line 115 of file class.ilECSConnector.php.

References $auth, $ilLog, $info, $result, $ret, addHeader(), call(), getHeader(), HEADER_MEMBERSHIPS, and prepareConnection().

116  {
117  global $ilLog;
118 
119  $ilLog->write(__METHOD__ . ': Add new Auth resource...');
120 
121  $this->path_postfix = '/sys/auths';
122 
123  try {
124  $this->prepareConnection();
125 
126  $this->addHeader('Content-Type', 'application/json');
127  $this->addHeader('Accept', 'application/json');
128  $this->addHeader(ilECSConnector::HEADER_MEMBERSHIPS, $a_target_mid);
129  #$this->addHeader(ilECSConnector::HEADER_MEMBERSHIPS, 1);
130 
131  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
132  $this->curl->setOpt(CURLOPT_POST, true);
133  $this->curl->setOpt(CURLOPT_POSTFIELDS, $a_post);
134  $ret = $this->call();
135 
136  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
137 
138  $ilLog->write(__METHOD__ . ': Checking HTTP status...');
139  if ($info != self::HTTP_CODE_CREATED) {
140  $ilLog->write(__METHOD__ . ': Cannot create auth resource, did not receive HTTP 201. ');
141  $ilLog->write(__METHOD__ . ': POST was: ' . $a_post);
142  $ilLog->write(__METHOD__ . ': HTTP code: ' . $info);
143  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
144  }
145  $ilLog->write(__METHOD__ . ': ... got HTTP 201 (created)');
146  $ilLog->write(__METHOD__ . ': POST was: ' . $a_post);
147 
148  $result = new ilECSResult($ret);
149  $auth = $result->getResult();
150 
151  $ilLog->write(__METHOD__ . ': ... got hash: ' . $auth->hash);
152 
153  return $auth->hash;
154  } catch (ilCurlConnectionException $exc) {
155  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
156  }
157  }
$auth
Definition: metadata.php:48
$result
$ret
Definition: parser.php:6
addHeader($a_name, $a_value)
Add Header.
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ addHeader()

ilECSConnector::addHeader (   $a_name,
  $a_value 
)

◆ addResource()

ilECSConnector::addResource (   $a_path,
  $a_post 
)

Add resource.

public

Parameters
stringresource "path"
stringpost data
Returns
int new econtent id
Exceptions
ilECSConnectorException

Definition at line 381 of file class.ilECSConnector.php.

References $ilLog, $info, $res, addHeader(), call(), getHeader(), and prepareConnection().

382  {
383  global $ilLog;
384 
385  $ilLog->write(__METHOD__ . ': Add new EContent...');
386 
387  $this->path_postfix = $a_path;
388 
389  try {
390  $this->prepareConnection();
391 
392  $this->addHeader('Content-Type', 'application/json');
393 
394  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
395  $this->curl->setOpt(CURLOPT_HEADER, true);
396  $this->curl->setOpt(CURLOPT_POST, true);
397  $this->curl->setOpt(CURLOPT_POSTFIELDS, $a_post);
398  $res = $this->call();
399 
400  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
401 
402  $ilLog->write(__METHOD__ . ': Checking HTTP status...');
403  if ($info != self::HTTP_CODE_CREATED) {
404  $ilLog->write(__METHOD__ . ': Cannot create econtent, did not receive HTTP 201. ');
405  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
406  }
407  $ilLog->write(__METHOD__ . ': ... got HTTP 201 (created)');
408 
409  $eid = self::_fetchEContentIdFromHeader($this->curl->getResponseHeaderArray());
410  return $eid;
411  } catch (ilCurlConnectionException $exc) {
412  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
413  }
414  }
foreach($_POST as $key=> $value) $res
addHeader($a_name, $a_value)
Add Header.
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ call()

◆ deleteResource()

ilECSConnector::deleteResource (   $a_path,
  $a_econtent_id 
)

Delete resource.

public

Parameters
stringresource "path"
stringecontent id
Exceptions
ilECSConnectorException

Definition at line 477 of file class.ilECSConnector.php.

References $ilLog, $res, call(), and prepareConnection().

478  {
479  global $ilLog;
480 
481  $ilLog->write(__METHOD__ . ': Delete resource with id ' . $a_econtent_id);
482 
483  $this->path_postfix = $a_path;
484 
485  if ($a_econtent_id) {
486  $this->path_postfix .= ('/' . (int) $a_econtent_id);
487  } else {
488  throw new ilECSConnectorException('Error calling deleteResource: No content id given.');
489  }
490 
491  try {
492  $this->prepareConnection();
493  $this->curl->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
494  $res = $this->call();
495  return new ilECSResult($res);
496  } catch (ilCurlConnectionException $exc) {
497  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
498  }
499  }
foreach($_POST as $key=> $value) $res
prepareConnection()
prepare connection
+ Here is the call graph for this function:

◆ getAuth()

ilECSConnector::getAuth (   $a_hash,
  $a_details_only = false 
)

get auth resource

public

Parameters
authhash (transfered via GET)
Exceptions
ilECSConnectorException

Definition at line 166 of file class.ilECSConnector.php.

References $ilLog, $info, $res, call(), and prepareConnection().

167  {
168  global $ilLog;
169 
170  if (!strlen($a_hash)) {
171  $ilLog->write(__METHOD__ . ': No auth hash given. Aborting.');
172  throw new ilECSConnectorException('No auth hash given.');
173  }
174 
175  $this->path_postfix = '/sys/auths/' . $a_hash;
176 
177  if ($a_details_only) {
178  $this->path_postfix .= ('/details');
179  }
180 
181 
182  try {
183  $this->prepareConnection();
184  $res = $this->call();
185  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
186 
187  $ilLog->write(__METHOD__ . ': Checking HTTP status...');
188  if ($info != self::HTTP_CODE_OK) {
189  $ilLog->write(__METHOD__ . ': Cannot get auth resource, did not receive HTTP 200. ');
190  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
191  }
192  $ilLog->write(__METHOD__ . ': ... got HTTP 200 (ok)');
193 
194  $ecs_result = new ilECSResult($res);
195  // Return ECSEContentDetails for details switch
196  if ($a_details_only) {
197  include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
198  $details = new ilECSEContentDetails();
199  $details->loadFromJson($ecs_result->getResult());
200  return $details;
201  }
202  return $ecs_result;
203  } catch (ilCurlConnectionException $exc) {
204  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
205  }
206  }
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
foreach($_POST as $key=> $value) $res
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ getEventQueues()

ilECSConnector::getEventQueues ( )

get event queue

public

Exceptions
ilECSConnectorException
Deprecated:

Definition at line 219 of file class.ilECSConnector.php.

References $ilLog, $info, $res, call(), and prepareConnection().

220  {
221  global $ilLog;
222 
223  $this->path_postfix = '/eventqueues';
224 
225  try {
226  $this->prepareConnection();
227 
228  $res = $this->call();
229  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
230 
231  $ilLog->write(__METHOD__ . ': Checking HTTP status...');
232  if ($info != self::HTTP_CODE_OK) {
233  $ilLog->write(__METHOD__ . ': Cannot get event queue, did not receive HTTP 200. ');
234  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
235  }
236  $ilLog->write(__METHOD__ . ': ... got HTTP 200 (ok)');
237  return new ilECSResult($res);
238  } catch (ilCurlConnectionException $exc) {
239  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
240  }
241  }
foreach($_POST as $key=> $value) $res
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ getHeader()

◆ getMemberships()

ilECSConnector::getMemberships (   $a_mid = 0)

public

Parameters
intmembership id
Exceptions
ilECSConnectorException

Definition at line 512 of file class.ilECSConnector.php.

References $ilLog, $info, $res, array, call(), and prepareConnection().

513  {
514  global $ilLog;
515 
516  $ilLog->write(__METHOD__ . ': Get existing memberships');
517 
518  $this->path_postfix = '/sys/memberships';
519  if ($a_mid) {
520  $ilLog->write(__METHOD__ . ': Read membership with id: ' . $a_mid);
521  $this->path_postfix .= ('/' . (int) $a_mid);
522  }
523  try {
524  $this->prepareConnection();
525  $res = $this->call();
526 
527  $this->curl->setOpt(CURLOPT_HTTPHEADER, array(0 => 'X-EcsQueryStrings: sender=true'));
528 
529  // Checking status code
530  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
531  if ($info != self::HTTP_CODE_OK) {
532  $ilLog->write(__METHOD__ . ': Cannot get memberships, did not receive HTTP 200. ');
533  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
534  }
535 
536  return new ilECSResult($res);
537  } catch (ilCurlConnectionException $exc) {
538  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
539  }
540  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ getResource()

ilECSConnector::getResource (   $a_path,
  $a_econtent_id,
  $a_details_only = false 
)

Get resources from ECS server.

public

Parameters
stringresource "path"
inte-content id
Returns
object ECSResult
Exceptions
ilECSConnectorException

Definition at line 330 of file class.ilECSConnector.php.

References $ilLog, $info, $res, $result, call(), and prepareConnection().

331  {
332  global $ilLog;
333 
334  if ($a_econtent_id) {
335  $ilLog->write(__METHOD__ . ': Get resource with ID: ' . $a_econtent_id);
336  } else {
337  $ilLog->write(__METHOD__ . ': Get all resources ...');
338  }
339 
340  $this->path_postfix = $a_path;
341  if ($a_econtent_id) {
342  $this->path_postfix .= ('/' . (int) $a_econtent_id);
343  }
344  if ($a_details_only) {
345  $this->path_postfix .= ('/details');
346  }
347 
348  try {
349  $this->prepareConnection();
350  $res = $this->call();
351 
352  // Checking status code
353  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
354  $ilLog->write(__METHOD__ . ': Checking HTTP status...');
355  if ($info != self::HTTP_CODE_OK) {
356  $ilLog->write(__METHOD__ . ': Cannot get ressource, did not receive HTTP 200. ');
357  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
358  }
359  $ilLog->write(__METHOD__ . ': ... got HTTP 200 (ok)');
360 
361  $result = new ilECSResult($res);
362  $result->setHeaders($this->curl->getResponseHeaderArray());
363  $result->setHTTPCode($info);
364 
365  return $result;
366  } catch (ilCurlConnectionException $exc) {
367  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
368  }
369  }
$result
foreach($_POST as $key=> $value) $res
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ getResourceList()

ilECSConnector::getResourceList (   $a_path)

Definition at line 292 of file class.ilECSConnector.php.

References $ilLog, $info, $res, call(), getHeader(), prepareConnection(), and ilECSResult\RESULT_TYPE_URL_LIST.

293  {
294  global $ilLog;
295 
296  $this->path_postfix = $a_path;
297 
298  try {
299  $this->prepareConnection();
300  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
301  $res = $this->call();
302 
303  // Checking status code
304  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
305  $ilLog->write(__METHOD__ . ': Checking HTTP status...');
306  if ($info != self::HTTP_CODE_OK) {
307  $ilLog->write(__METHOD__ . ': Cannot get ressource list, did not receive HTTP 200. ');
308  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
309  }
310  $ilLog->write(__METHOD__ . ': ... got HTTP 200 (ok)');
311 
313  } catch (ilCurlConnectionException $exc) {
314  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
315  }
316  }
const RESULT_TYPE_URL_LIST
foreach($_POST as $key=> $value) $res
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ getServer()

ilECSConnector::getServer ( )

Get current server setting.

Returns
ilECSSetting

Definition at line 96 of file class.ilECSConnector.php.

References $settings.

Referenced by prepareConnection().

97  {
98  return $this->settings;
99  }
+ Here is the caller graph for this function:

◆ prepareConnection()

ilECSConnector::prepareConnection ( )
protected

prepare connection

private

Exceptions
ilCurlConnectionException

Definition at line 548 of file class.ilECSConnector.php.

References $path_postfix, array, ilECSSetting\AUTH_APACHE, ilECSSetting\AUTH_CERTIFICATE, getServer(), ilCurlConnection\init(), and settings().

Referenced by addAuth(), ilECSEnrolmentStatusConnector\addEnrolmentStatus(), addResource(), ilECSCourseUrlConnector\addUrl(), deleteResource(), getAuth(), ilECSCourseConnector\getCourse(), ilECSCourseMemberConnector\getCourseMember(), ilECSDirectoryTreeConnector\getDirectoryTree(), ilECSDirectoryTreeConnector\getDirectoryTrees(), ilECSEnrolmentStatusConnector\getEnrolmentStatus(), getEventQueues(), getMemberships(), getResource(), getResourceList(), readEventFifo(), and updateResource().

549  {
550  try {
551  $this->curl = new ilCurlConnection($this->settings->getServerURI() . $this->path_postfix);
552  $this->curl->init();
553  $this->curl->setOpt(CURLOPT_HTTPHEADER, array(0 => 'Accept: application/json'));
554  $this->curl->setOpt(CURLOPT_RETURNTRANSFER, 1);
555  $this->curl->setOpt(CURLOPT_VERBOSE, 1);
556  $this->curl->setOpt(CURLOPT_TIMEOUT_MS, 2000);
557 
558  switch ($this->getServer()->getAuthType()) {
560  $this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
561  #$this->curl->setOpt(CURLOPT_SSL_VERIFYHOST,0);
562  $this->curl->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
563  $this->curl->setOpt(
564  CURLOPT_USERPWD,
565  $this->getServer()->getAuthUser() . ':' . $this->getServer()->getAuthPass()
566  );
567  break;
568 
570  $this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, 1);
571  // use default 2 for libcurl 7.28.1 support
572  $this->curl->setOpt(CURLOPT_SSL_VERIFYHOST, 2);
573  $this->curl->setOpt(CURLOPT_CAINFO, $this->settings->getCACertPath());
574  $this->curl->setOpt(CURLOPT_SSLCERT, $this->settings->getClientCertPath());
575  $this->curl->setOpt(CURLOPT_SSLKEY, $this->settings->getKeyPath());
576  $this->curl->setOpt(CURLOPT_SSLKEYPASSWD, $this->settings->getKeyPassword());
577  break;
578 
579  }
580  } catch (ilCurlConnectionException $exc) {
581  throw($exc);
582  }
583  }
init()
Init curl connection.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
getServer()
Get current server setting.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readEventFifo()

ilECSConnector::readEventFifo (   $a_delete = false)

Read event fifo.

Parameters
boolset to true for deleting the current element
Exceptions
ilECSConnectorException

Definition at line 252 of file class.ilECSConnector.php.

References $ilLog, $info, $res, $result, addHeader(), call(), and prepareConnection().

253  {
254  global $ilLog;
255 
256  $this->path_postfix = '/sys/events/fifo';
257 
258  try {
259  $this->prepareConnection();
260  $this->addHeader('Content-Type', 'application/json');
261  $this->addHeader('Accept', 'application/json');
262 
263  if ($a_delete) {
264  $this->curl->setOpt(CURLOPT_POST, true);
265  $this->curl->setOpt(CURLOPT_POSTFIELDS, '');
266  }
267  $res = $this->call();
268 
269  // Checking status code
270  $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
271  #$ilLog->write(__METHOD__.': Checking HTTP status...');
272  if ($info != self::HTTP_CODE_OK) {
273  $ilLog->write(__METHOD__ . ': Cannot read event fifo, did not receive HTTP 200. ');
274  throw new ilECSConnectorException('Received HTTP status code: ' . $info);
275  }
276  #$ilLog->write(__METHOD__.': ... got HTTP 200 (ok)');
277 
278  $result = new ilECSResult($res);
279 
280  #$GLOBALS['ilLog']->write(__METHOD__.':------------------------------------- FIFO content'. print_r($result,true));
281 
282  return $result;
283  } catch (ilCurlConnectionException $exc) {
284  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
285  }
286  }
$result
foreach($_POST as $key=> $value) $res
addHeader($a_name, $a_value)
Add Header.
prepareConnection()
prepare connection
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ setHeader()

ilECSConnector::setHeader (   $a_header_strings)

Definition at line 87 of file class.ilECSConnector.php.

Referenced by ilECSCourseConnector\getCourse(), ilECSCourseMemberConnector\getCourseMember(), ilECSDirectoryTreeConnector\getDirectoryTree(), ilECSDirectoryTreeConnector\getDirectoryTrees(), and ilECSEnrolmentStatusConnector\getEnrolmentStatus().

88  {
89  $this->header_strings = $a_header_strings;
90  }
+ Here is the caller graph for this function:

◆ updateResource()

ilECSConnector::updateResource (   $a_path,
  $a_econtent_id,
  $a_post_string 
)

update resource

public

Parameters
stringresource "path"
intecontent id
stringpost content
Exceptions
ilECSConnectorException

Definition at line 425 of file class.ilECSConnector.php.

References $ilLog, $res, addHeader(), call(), getHeader(), ilUtil\ilTempnam(), and prepareConnection().

426  {
427  global $ilLog;
428 
429  $ilLog->write(__METHOD__ . ': Update resource with id ' . $a_econtent_id);
430 
431  $this->path_postfix = $a_path;
432 
433  if ($a_econtent_id) {
434  $this->path_postfix .= ('/' . (int) $a_econtent_id);
435  } else {
436  throw new ilECSConnectorException('Error calling updateResource: No content id given.');
437  }
438  try {
439  $this->prepareConnection();
440  $this->addHeader('Content-Type', 'application/json');
441  $this->addHeader('Accept', 'application/json');
442  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
443  $this->curl->setOpt(CURLOPT_HEADER, true);
444  $this->curl->setOpt(CURLOPT_PUT, true);
445 
446  $tempfile = ilUtil::ilTempnam();
447  $ilLog->write(__METHOD__ . ': Created new tempfile: ' . $tempfile);
448 
449  $fp = fopen($tempfile, 'w');
450  fwrite($fp, $a_post_string);
451  fclose($fp);
452 
453  $this->curl->setOpt(CURLOPT_UPLOAD, true);
454  $this->curl->setOpt(CURLOPT_INFILESIZE, filesize($tempfile));
455  $fp = fopen($tempfile, 'r');
456  $this->curl->setOpt(CURLOPT_INFILE, $fp);
457 
458  $res = $this->call();
459 
460  fclose($fp);
461  unlink($tempfile);
462 
463  return new ilECSResult($res);
464  } catch (ilCurlConnectionException $exc) {
465  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
466  }
467  }
foreach($_POST as $key=> $value) $res
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
addHeader($a_name, $a_value)
Add Header.
prepareConnection()
prepare connection
+ Here is the call graph for this function:

Field Documentation

◆ $header_strings

ilECSConnector::$header_strings = array()
protected

Definition at line 52 of file class.ilECSConnector.php.

Referenced by getHeader().

◆ $path_postfix

ilECSConnector::$path_postfix = ''
protected

Definition at line 48 of file class.ilECSConnector.php.

Referenced by prepareConnection().

◆ $settings

◆ HEADER_COMMUNITIES

const ilECSConnector::HEADER_COMMUNITIES = 'X-EcsReceiverCommunities'

Definition at line 45 of file class.ilECSConnector.php.

◆ HEADER_MEMBERSHIPS

const ilECSConnector::HEADER_MEMBERSHIPS = 'X-EcsReceiverMemberships'

◆ HTTP_CODE_CREATED

const ilECSConnector::HTTP_CODE_CREATED = 201

Definition at line 40 of file class.ilECSConnector.php.

◆ HTTP_CODE_NOT_FOUND

const ilECSConnector::HTTP_CODE_NOT_FOUND = 404

◆ HTTP_CODE_OK

const ilECSConnector::HTTP_CODE_OK = 200

Definition at line 41 of file class.ilECSConnector.php.


The documentation for this class was generated from the following file: