ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilBMFTransport.php
Go to the documentation of this file.
1 <?php
23 require_once dirname(__FILE__).'/class.ilBMFBase.php';
24 
37 {
38  function &getTransport($url, $encoding = SOAP_DEFAULT_ENCODING)
39  {
40  $urlparts = @parse_url($url);
41 
42  if (!$urlparts['scheme']) {
43  $fault = ilBMFBase_Object::_raiseSoapFault("Invalid transport URI: $url");
44  return $fault;
45  }
46 
47  if (strcasecmp($urlparts['scheme'], 'mailto') == 0) {
48  $transport_type = 'SMTP';
49  } elseif (strcasecmp($urlparts['scheme'], 'https') == 0) {
50  $transport_type = 'HTTP';
51  } else {
52  /* handle other transport types */
53  $transport_type = strtoupper($urlparts['scheme']);
54  }
55  $transport_include = dirname(__FILE__).'/Transport/class.ilBMFTransport_' . $transport_type . '.php';
56  $res = @include_once($transport_include);
57  if (!$res && !in_array($transport_include, get_included_files())) {
58  $fault = ilBMFBase_Object::_raiseSoapFault("No Transport for {$urlparts['scheme']}");
59  return $fault;
60  }
61  $transport_class = "ilBMFTransport_$transport_type";
62  if (!class_exists($transport_class)) {
63  $fault = ilBMFBase_Object::_raiseSoapFault("No Transport class $transport_class");
64  return $fault;
65  }
66  $t =& new $transport_class($url, $encoding);
67 
68  return $t;
69  }
70 
71 }