ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
soap_transport_http Class Reference

transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support More...

+ Inheritance diagram for soap_transport_http:
+ Collaboration diagram for soap_transport_http:

Public Member Functions

 soap_transport_http ($url)
 constructor More...
 
 connect ($connection_timeout=0, $response_timeout=30)
 
 send ($data, $timeout=0, $response_timeout=30)
 send the SOAP message via HTTP More...
 
 sendHTTPS ($data, $timeout=0, $response_timeout=30)
 send the SOAP message via HTTPS 1.0 using CURL More...
 
 setCredentials ($username, $password, $authtype='basic', $digestRequest=array())
 if authenticating, set user credentials here More...
 
 setSOAPAction ($soapaction)
 set the soapaction value More...
 
 setEncoding ($enc='gzip, deflate')
 use http encoding More...
 
 setProxy ($proxyhost, $proxyport, $proxyusername='', $proxypassword='')
 set proxy info here More...
 
 decodeChunked ($buffer, $lb)
 decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6 More...
 
 buildPayload ($data)
 
 sendRequest ($data)
 
 getResponse ()
 
 setContentType ($type, $charset=false)
 
 usePersistentConnection ()
 
 __construct ($url, $curl_options=NULL, $use_curl=false)
 constructor More...
 
 setCurlOption ($option, $value)
 sets a cURL option More...
 
 setHeader ($name, $value)
 sets an HTTP header More...
 
 unsetHeader ($name)
 unsets an HTTP header More...
 
 setURL ($url)
 sets the URL to which to connect More...
 
 io_method ()
 gets the I/O method to use More...
 
 connect ($connection_timeout=0, $response_timeout=30)
 establish an HTTP connection More...
 
 send ($data, $timeout=0, $response_timeout=30, $cookies=NULL)
 sends the SOAP request and gets the SOAP response via HTTP[S] More...
 
 sendHTTPS ($data, $timeout=0, $response_timeout=30, $cookies)
 sends the SOAP request and gets the SOAP response via HTTPS using CURL More...
 
 setCredentials ($username, $password, $authtype='basic', $digestRequest=array(), $certRequest=array())
 if authenticating, set user credentials here More...
 
 setSOAPAction ($soapaction)
 set the soapaction value More...
 
 setEncoding ($enc='gzip, deflate')
 use http encoding More...
 
 setProxy ($proxyhost, $proxyport, $proxyusername='', $proxypassword='', $proxyauthtype='basic')
 set proxy info here More...
 
 isSkippableCurlHeader (&$data)
 Test if the given string starts with a header that is to be skipped. More...
 
 decodeChunked ($buffer, $lb)
 decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6 More...
 
 buildPayload ($data, $cookie_str='')
 Writes the payload, including HTTP headers, to $this->outgoing_payload. More...
 
 sendRequest ($data, $cookies=NULL)
 sends the SOAP request via HTTP[S] More...
 
 getResponse ()
 gets the SOAP response via HTTP[S] More...
 
 setContentType ($type, $charset=false)
 sets the content-type for the SOAP message to be sent More...
 
 usePersistentConnection ()
 specifies that an HTTP persistent connection should be used More...
 
 parseCookie ($cookie_str)
 parse an incoming Cookie into it's parts More...
 
 getCookiesForRequest ($cookies, $secure=false)
 sort out cookies for the current request More...
 
- Public Member Functions inherited from nusoap_base
 debug ($string)
 adds debug data to the class level debug string More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
 serialize message More...
 
 formatDump ($str)
 
 contractQname ($qname)
 contracts a qualified name More...
 
 expandQname ($qname)
 expands a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace returns false if no namespace registered with the given prefix More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 varDump ($data)
 
 __construct ()
 constructor More...
 
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances More...
 
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances More...
 
 getDebugLevel ()
 gets the debug level for this instance More...
 
 setDebugLevel ($level)
 sets the debug level for this instance More...
 
 debug ($string)
 adds debug data to the instance debug string with formatting More...
 
 appendDebug ($string)
 adds debug data to the instance debug string without formatting More...
 
 clearDebug ()
 clears the current debug data for this instance More...
 
getDebug ()
 gets the current debug data for this instance More...
 
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message More...
 
 formatDump ($str)
 formats a string to be inserted into an HTML stream More...
 
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name More...
 
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds More...
 
 varDump ($data)
 Returns a string with the output of var_dump. More...
 
 __toString ()
 represents the object as a string More...
 

Data Fields

 $url = ''
 
 $uri = ''
 
 $scheme = ''
 
 $host = ''
 
 $port = ''
 
 $path = ''
 
 $request_method = 'POST'
 
 $protocol_version = '1.0'
 
 $encoding = ''
 
 $outgoing_headers = array()
 
 $incoming_headers = array()
 
 $outgoing_payload = ''
 
 $incoming_payload = ''
 
 $useSOAPAction = true
 
 $persistentConnection = false
 
 $ch = false
 
 $username = ''
 
 $password = ''
 
 $digest_uri = ''
 
 $incoming_cookies = array()
 
 $response_status_line
 
 $ch_options = array()
 
 $use_curl = false
 
 $proxy = null
 
 $authtype = ''
 
 $digestRequest = array()
 
 $certRequest = array()
 
- Data Fields inherited from nusoap_base
 $title = 'NuSOAP'
 
 $version = '0.6.7'
 
 $revision = '$Revision$'
 
 $error_str = false
 
 $debug_str = ''
 
 $charencoding = true
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 
 $debugLevel
 

Detailed Description

transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support

Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com
Version
$Id$ public
Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com
Scott Nichol snich.nosp@m.ol@u.nosp@m.sers..nosp@m.sour.nosp@m.cefor.nosp@m.ge.n.nosp@m.et
Version
$Id$ public

Definition at line 1552 of file nusoap.php.

Constructor & Destructor Documentation

◆ __construct()

soap_transport_http::__construct (   $url,
  $curl_options = NULL,
  $use_curl = false 
)

constructor

Parameters
string$urlThe URL to which to connect
array$curl_optionsUser-specified cURL options
boolean$use_curlWhether to try to force cURL use public

Definition at line 2176 of file nusoap.php.

References nusoap_base\appendDebug(), nusoap_base\debug(), Sabre\HTTP\setHeader(), and nusoap_base\varDump().

2176  {
2177  parent::__construct();
2178  $this->debug("ctor url=$url use_curl=$use_curl curl_options:");
2179  $this->appendDebug($this->varDump($curl_options));
2180  $this->setURL($url);
2181  if (is_array($curl_options)) {
2182  $this->ch_options = $curl_options;
2183  }
2184  $this->use_curl = $use_curl;
2185  preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
2186  $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
2187  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
setURL($url)
sets the URL to which to connect
Definition: nusoap.php:2233
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
varDump($data)
Definition: nusoap.php:567
+ Here is the call graph for this function:

Member Function Documentation

◆ buildPayload() [1/2]

soap_transport_http::buildPayload (   $data)

Definition at line 1960 of file nusoap.php.

References $data.

1960  {
1961  // add content-length header
1962  $this->outgoing_headers['Content-Length'] = strlen($data);
1963 
1964  // start building outgoing payload:
1965  $this->outgoing_payload = "$this->request_method $this->uri HTTP/$this->protocol_version\r\n";
1966 
1967  // loop thru headers, serializing
1968  foreach($this->outgoing_headers as $k => $v){
1969  $this->outgoing_payload .= $k.': '.$v."\r\n";
1970  }
1971 
1972  // header/body separator
1973  $this->outgoing_payload .= "\r\n";
1974 
1975  // add data
1976  $this->outgoing_payload .= $data;
1977  }
$data
Definition: bench.php:6

◆ buildPayload() [2/2]

soap_transport_http::buildPayload (   $data,
  $cookie_str = '' 
)

Writes the payload, including HTTP headers, to $this->outgoing_payload.

Parameters
string$dataHTTP body
string$cookie_strdata for HTTP Cookie header
Returns
void private

Definition at line 2804 of file nusoap.php.

References $data, $req, $url, nusoap_base\debug(), and Sabre\HTTP\setHeader().

2804  {
2805  // Note: for cURL connections, $this->outgoing_payload is ignored,
2806  // as is the Content-Length header, but these are still created as
2807  // debugging guides.
2808 
2809  // add content-length header
2810  $this->setHeader('Content-Length', strlen($data));
2811 
2812  // start building outgoing payload:
2813  if ($this->proxy) {
2814  $uri = $this->url;
2815  } else {
2816  $uri = $this->uri;
2817  }
2818  $req = "$this->request_method $uri HTTP/$this->protocol_version";
2819  $this->debug("HTTP request: $req");
2820  $this->outgoing_payload = "$req\r\n";
2821 
2822  // loop thru headers, serializing
2823  foreach($this->outgoing_headers as $k => $v){
2824  $hdr = $k.': '.$v;
2825  $this->debug("HTTP header: $hdr");
2826  $this->outgoing_payload .= "$hdr\r\n";
2827  }
2828 
2829  // add any cookies
2830  if ($cookie_str != '') {
2831  $hdr = 'Cookie: '.$cookie_str;
2832  $this->debug("HTTP header: $hdr");
2833  $this->outgoing_payload .= "$hdr\r\n";
2834  }
2835 
2836  // header/body separator
2837  $this->outgoing_payload .= "\r\n";
2838 
2839  // add data
2840  $this->outgoing_payload .= $data;
2841  }
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
$req
Definition: getUserInfo.php:20
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ connect() [1/2]

soap_transport_http::connect (   $connection_timeout = 0,
  $response_timeout = 30 
)

Definition at line 1615 of file nusoap.php.

References nusoap_base\$error_str, $path, $url, nusoap_base\debug(), and nusoap_base\setError().

1615  {
1616  // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
1617  // "regular" socket.
1618  // TODO: disabled for now because OpenSSL must be *compiled* in (not just
1619  // loaded), and until PHP5 stream_get_wrappers is not available.
1620 // if ($this->scheme == 'https') {
1621 // if (version_compare(phpversion(), '4.3.0') >= 0) {
1622 // if (extension_loaded('openssl')) {
1623 // $this->scheme = 'ssl';
1624 // $this->debug('Using SSL over OpenSSL');
1625 // }
1626 // }
1627 // }
1628  $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
1629  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
1630  // use persistent connection
1631  if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
1632  if (!feof($this->fp)) {
1633  $this->debug('Re-use persistent connection');
1634  return true;
1635  }
1636  fclose($this->fp);
1637  $this->debug('Closed persistent connection at EOF');
1638  }
1639 
1640  // munge host if using OpenSSL
1641  if ($this->scheme == 'ssl') {
1642  $host = 'ssl://' . $this->host;
1643  } else {
1644  $host = $this->host;
1645  }
1646  $this->debug('calling fsockopen with host ' . $host);
1647 
1648  // open socket
1649  if($connection_timeout > 0){
1650  $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
1651  } else {
1652  $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
1653  }
1654 
1655  // test pointer
1656  if(!$this->fp) {
1657  $msg = 'Couldn\'t open socket connection to server ' . $this->url;
1658  if ($this->errno) {
1659  $msg .= ', Error ('.$this->errno.'): '.$this->error_str;
1660  } else {
1661  $msg .= ' prior to connect(). This is often a problem looking up the host name.';
1662  }
1663  $this->debug($msg);
1664  $this->setError($msg);
1665  return false;
1666  }
1667 
1668  // set response timeout
1669  socket_set_timeout( $this->fp, $response_timeout);
1670 
1671  $this->debug('socket connected');
1672  return true;
1673  } else if ($this->scheme == 'https') {
1674  if (!extension_loaded('curl')) {
1675  $this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
1676  return false;
1677  }
1678  $this->debug('connect using https');
1679  // init CURL
1680  $this->ch = curl_init();
1681  // set url
1682  $hostURL = ($this->port != '') ? "https://$this->host:$this->port" : "https://$this->host";
1683  // add path
1684  $hostURL .= $this->path;
1685  curl_setopt($this->ch, CURLOPT_URL, $hostURL);
1686  // ask for headers in the response output
1687  curl_setopt($this->ch, CURLOPT_HEADER, 1);
1688  // ask for the response output as the return value
1689  curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
1690  // encode
1691  // We manage this ourselves through headers and encoding
1692 // if(function_exists('gzuncompress')){
1693 // curl_setopt($this->ch, CURLOPT_ENCODING, 'deflate');
1694 // }
1695  // persistent connection
1696  if ($this->persistentConnection) {
1697  // The way we send data, we cannot use persistent connections, since
1698  // there will be some "junk" at the end of our request.
1699  //curl_setopt($this->ch, CURL_HTTP_VERSION_1_1, true);
1700  $this->persistentConnection = false;
1701  $this->outgoing_headers['Connection'] = 'close';
1702  }
1703  // set timeout (NOTE: cURL does not have separate connection and response timeouts)
1704  if ($connection_timeout != 0) {
1705  curl_setopt($this->ch, CURLOPT_TIMEOUT, $connection_timeout);
1706  }
1707 
1708  // recent versions of cURL turn on peer/host checking by default,
1709  // while PHP binaries are not compiled with a default location for the
1710  // CA cert bundle, so disable peer/host checking.
1711 //curl_setopt($this->ch, CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');
1712  curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
1713  curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
1714 
1715  /*
1716  TODO: support client certificates (thanks Tobias Boes)
1717  curl_setopt($this->ch, CURLOPT_CAINFO, '$pathToPemFiles/rootca.pem');
1718  curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 1);
1719  curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 1);
1720  curl_setopt($this->ch, CURLOPT_SSLCERT, '$pathToPemFiles/mycert.pem');
1721  curl_setopt($this->ch, CURLOPT_SSLKEY, '$pathToPemFiles/mykey.pem');
1722  */
1723  $this->debug('cURL connection set up');
1724  return true;
1725  } else {
1726  $this->setError('Unknown scheme ' . $this->scheme);
1727  $this->debug('Unknown scheme ' . $this->scheme);
1728  return false;
1729  }
1730  }
setError($str)
sets error string
Definition: nusoap.php:184
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ connect() [2/2]

soap_transport_http::connect (   $connection_timeout = 0,
  $response_timeout = 30 
)

establish an HTTP connection

Parameters
integer$timeoutset connection timeout in seconds
integer$response_timeoutset response timeout in seconds
Returns
boolean true if connected, false if not private

Definition at line 2293 of file nusoap.php.

References nusoap_base\$error_str, $path, $url, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\setError(), Sabre\HTTP\setHeader(), and nusoap_base\varDump().

2293  {
2294  // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
2295  // "regular" socket.
2296  // TODO: disabled for now because OpenSSL must be *compiled* in (not just
2297  // loaded), and until PHP5 stream_get_wrappers is not available.
2298 // if ($this->scheme == 'https') {
2299 // if (version_compare(phpversion(), '4.3.0') >= 0) {
2300 // if (extension_loaded('openssl')) {
2301 // $this->scheme = 'ssl';
2302 // $this->debug('Using SSL over OpenSSL');
2303 // }
2304 // }
2305 // }
2306  $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
2307  if ($this->io_method() == 'socket') {
2308  if (!is_array($this->proxy)) {
2309  $host = $this->host;
2310  $port = $this->port;
2311  } else {
2312  $host = $this->proxy['host'];
2313  $port = $this->proxy['port'];
2314  }
2315 
2316  // use persistent connection
2317  if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
2318  if (!feof($this->fp)) {
2319  $this->debug('Re-use persistent connection');
2320  return true;
2321  }
2322  fclose($this->fp);
2323  $this->debug('Closed persistent connection at EOF');
2324  }
2325 
2326  // munge host if using OpenSSL
2327  if ($this->scheme == 'ssl') {
2328  $host = 'ssl://' . $host;
2329  }
2330  $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
2331 
2332  // open socket
2333  if($connection_timeout > 0){
2334  $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
2335  } else {
2336  $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
2337  }
2338 
2339  // test pointer
2340  if(!$this->fp) {
2341  $msg = 'Couldn\'t open socket connection to server ' . $this->url;
2342  if ($this->errno) {
2343  $msg .= ', Error ('.$this->errno.'): '.$this->error_str;
2344  } else {
2345  $msg .= ' prior to connect(). This is often a problem looking up the host name.';
2346  }
2347  $this->debug($msg);
2348  $this->setError($msg);
2349  return false;
2350  }
2351 
2352  // set response timeout
2353  $this->debug('set response timeout to ' . $response_timeout);
2354  socket_set_timeout( $this->fp, $response_timeout);
2355 
2356  $this->debug('socket connected');
2357  return true;
2358  } else if ($this->io_method() == 'curl') {
2359  if (!extension_loaded('curl')) {
2360 // $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
2361  $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to included cURL.');
2362  return false;
2363  }
2364  // Avoid warnings when PHP does not have these options
2365  if (defined('CURLOPT_CONNECTIONTIMEOUT'))
2366  $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT;
2367  else
2368  $CURLOPT_CONNECTIONTIMEOUT = 78;
2369  if (defined('CURLOPT_HTTPAUTH'))
2370  $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;
2371  else
2372  $CURLOPT_HTTPAUTH = 107;
2373  if (defined('CURLOPT_PROXYAUTH'))
2374  $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;
2375  else
2376  $CURLOPT_PROXYAUTH = 111;
2377  if (defined('CURLAUTH_BASIC'))
2378  $CURLAUTH_BASIC = CURLAUTH_BASIC;
2379  else
2380  $CURLAUTH_BASIC = 1;
2381  if (defined('CURLAUTH_DIGEST'))
2382  $CURLAUTH_DIGEST = CURLAUTH_DIGEST;
2383  else
2384  $CURLAUTH_DIGEST = 2;
2385  if (defined('CURLAUTH_NTLM'))
2386  $CURLAUTH_NTLM = CURLAUTH_NTLM;
2387  else
2388  $CURLAUTH_NTLM = 8;
2389 
2390  $this->debug('connect using cURL');
2391  // init CURL
2392  $this->ch = curl_init();
2393  // set url
2394  $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host";
2395  // add path
2396  $hostURL .= $this->path;
2397  $this->setCurlOption(CURLOPT_URL, $hostURL);
2398  // follow location headers (re-directs)
2399  if (ini_get('safe_mode') || ini_get('open_basedir')) {
2400  $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION');
2401  $this->debug('safe_mode = ');
2402  $this->appendDebug($this->varDump(ini_get('safe_mode')));
2403  $this->debug('open_basedir = ');
2404  $this->appendDebug($this->varDump(ini_get('open_basedir')));
2405  } else {
2406  $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1);
2407  }
2408  // ask for headers in the response output
2409  $this->setCurlOption(CURLOPT_HEADER, 1);
2410  // ask for the response output as the return value
2411  $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1);
2412  // encode
2413  // We manage this ourselves through headers and encoding
2414 // if(function_exists('gzuncompress')){
2415 // $this->setCurlOption(CURLOPT_ENCODING, 'deflate');
2416 // }
2417  // persistent connection
2418  if ($this->persistentConnection) {
2419  // I believe the following comment is now bogus, having applied to
2420  // the code when it used CURLOPT_CUSTOMREQUEST to send the request.
2421  // The way we send data, we cannot use persistent connections, since
2422  // there will be some "junk" at the end of our request.
2423  //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true);
2424  $this->persistentConnection = false;
2425  $this->setHeader('Connection', 'close');
2426  }
2427  // set timeouts
2428  if ($connection_timeout != 0) {
2429  $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
2430  }
2431  if ($response_timeout != 0) {
2432  $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout);
2433  }
2434 
2435  if ($this->scheme == 'https') {
2436  $this->debug('set cURL SSL verify options');
2437  // recent versions of cURL turn on peer/host checking by default,
2438  // while PHP binaries are not compiled with a default location for the
2439  // CA cert bundle, so disable peer/host checking.
2440  //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');
2441  $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0);
2442  $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0);
2443 
2444  // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo)
2445  if ($this->authtype == 'certificate') {
2446  $this->debug('set cURL certificate options');
2447  if (isset($this->certRequest['cainfofile'])) {
2448  $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']);
2449  }
2450  if (isset($this->certRequest['verifypeer'])) {
2451  $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
2452  } else {
2453  $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1);
2454  }
2455  if (isset($this->certRequest['verifyhost'])) {
2456  $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
2457  } else {
2458  $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1);
2459  }
2460  if (isset($this->certRequest['sslcertfile'])) {
2461  $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
2462  }
2463  if (isset($this->certRequest['sslkeyfile'])) {
2464  $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
2465  }
2466  if (isset($this->certRequest['passphrase'])) {
2467  $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']);
2468  }
2469  if (isset($this->certRequest['certpassword'])) {
2470  $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']);
2471  }
2472  }
2473  }
2474  if ($this->authtype && ($this->authtype != 'certificate')) {
2475  if ($this->username) {
2476  $this->debug('set cURL username/password');
2477  $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password");
2478  }
2479  if ($this->authtype == 'basic') {
2480  $this->debug('set cURL for Basic authentication');
2481  $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC);
2482  }
2483  if ($this->authtype == 'digest') {
2484  $this->debug('set cURL for digest authentication');
2485  $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST);
2486  }
2487  if ($this->authtype == 'ntlm') {
2488  $this->debug('set cURL for NTLM authentication');
2489  $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM);
2490  }
2491  }
2492  if (is_array($this->proxy)) {
2493  $this->debug('set cURL proxy options');
2494  if ($this->proxy['port'] != '') {
2495  $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']);
2496  } else {
2497  $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']);
2498  }
2499  if ($this->proxy['username'] || $this->proxy['password']) {
2500  $this->debug('set cURL proxy authentication options');
2501  $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']);
2502  if ($this->proxy['authtype'] == 'basic') {
2503  $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC);
2504  }
2505  if ($this->proxy['authtype'] == 'ntlm') {
2506  $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM);
2507  }
2508  }
2509  }
2510  $this->debug('cURL connection set up');
2511  return true;
2512  } else {
2513  $this->setError('Unknown scheme ' . $this->scheme);
2514  $this->debug('Unknown scheme ' . $this->scheme);
2515  return false;
2516  }
2517  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
setError($str)
sets error string
Definition: nusoap.php:184
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
setCurlOption($option, $value)
sets a cURL option
Definition: nusoap.php:2196
varDump($data)
Definition: nusoap.php:567
io_method()
gets the I/O method to use
Definition: nusoap.php:2277
+ Here is the call graph for this function:

◆ decodeChunked() [1/2]

soap_transport_http::decodeChunked (   $buffer,
  $lb 
)

decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6

Parameters
string$buffer
string$lb
Returns
string public

Definition at line 1908 of file nusoap.php.

References nusoap_base\debug().

1908  {
1909  // length := 0
1910  $length = 0;
1911  $new = '';
1912 
1913  // read chunk-size, chunk-extension (if any) and CRLF
1914  // get the position of the linebreak
1915  $chunkend = strpos($buffer, $lb);
1916  if ($chunkend == FALSE) {
1917  $this->debug('no linebreak found in decodeChunked');
1918  return $new;
1919  }
1920  $temp = substr($buffer,0,$chunkend);
1921  $chunk_size = hexdec( trim($temp) );
1922  $chunkstart = $chunkend + strlen($lb);
1923  // while (chunk-size > 0) {
1924  while ($chunk_size > 0) {
1925  $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
1926  $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
1927 
1928  // Just in case we got a broken connection
1929  if ($chunkend == FALSE) {
1930  $chunk = substr($buffer,$chunkstart);
1931  // append chunk-data to entity-body
1932  $new .= $chunk;
1933  $length += strlen($chunk);
1934  break;
1935  }
1936 
1937  // read chunk-data and CRLF
1938  $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
1939  // append chunk-data to entity-body
1940  $new .= $chunk;
1941  // length := length + chunk-size
1942  $length += strlen($chunk);
1943  // read chunk-size and CRLF
1944  $chunkstart = $chunkend + strlen($lb);
1945 
1946  $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
1947  if ($chunkend == FALSE) {
1948  break; //Just in case we got a broken connection
1949  }
1950  $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
1951  $chunk_size = hexdec( trim($temp) );
1952  $chunkstart = $chunkend;
1953  }
1954  return $new;
1955  }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ decodeChunked() [2/2]

soap_transport_http::decodeChunked (   $buffer,
  $lb 
)

decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6

Parameters
string$buffer
string$lb
Returns
string public
Deprecated:

Definition at line 2747 of file nusoap.php.

References nusoap_base\debug().

2747  {
2748  // length := 0
2749  $length = 0;
2750  $new = '';
2751 
2752  // read chunk-size, chunk-extension (if any) and CRLF
2753  // get the position of the linebreak
2754  $chunkend = strpos($buffer, $lb);
2755  if ($chunkend == FALSE) {
2756  $this->debug('no linebreak found in decodeChunked');
2757  return $new;
2758  }
2759  $temp = substr($buffer,0,$chunkend);
2760  $chunk_size = hexdec( trim($temp) );
2761  $chunkstart = $chunkend + strlen($lb);
2762  // while (chunk-size > 0) {
2763  while ($chunk_size > 0) {
2764  $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
2765  $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
2766 
2767  // Just in case we got a broken connection
2768  if ($chunkend == FALSE) {
2769  $chunk = substr($buffer,$chunkstart);
2770  // append chunk-data to entity-body
2771  $new .= $chunk;
2772  $length += strlen($chunk);
2773  break;
2774  }
2775 
2776  // read chunk-data and CRLF
2777  $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
2778  // append chunk-data to entity-body
2779  $new .= $chunk;
2780  // length := length + chunk-size
2781  $length += strlen($chunk);
2782  // read chunk-size and CRLF
2783  $chunkstart = $chunkend + strlen($lb);
2784 
2785  $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
2786  if ($chunkend == FALSE) {
2787  break; //Just in case we got a broken connection
2788  }
2789  $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
2790  $chunk_size = hexdec( trim($temp) );
2791  $chunkstart = $chunkend;
2792  }
2793  return $new;
2794  }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ getCookiesForRequest()

soap_transport_http::getCookiesForRequest (   $cookies,
  $secure = false 
)

sort out cookies for the current request

Parameters
array$cookiesarray with all cookies
boolean$secureis the send-content secure or not?
Returns
string for Cookie-HTTP-Header private

Definition at line 3380 of file nusoap.php.

References $domain, and nusoap_base\debug().

3380  {
3381  $cookie_str = '';
3382  if ((! is_null($cookies)) && (is_array($cookies))) {
3383  foreach ($cookies as $cookie) {
3384  if (! is_array($cookie)) {
3385  continue;
3386  }
3387  $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
3388  if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
3389  if (strtotime($cookie['expires']) <= time()) {
3390  $this->debug('cookie has expired');
3391  continue;
3392  }
3393  }
3394  if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
3395  $domain = preg_quote($cookie['domain']);
3396  if (! preg_match("'.*$domain$'i", $this->host)) {
3397  $this->debug('cookie has different domain');
3398  continue;
3399  }
3400  }
3401  if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
3402  $path = preg_quote($cookie['path']);
3403  if (! preg_match("'^$path.*'i", $this->path)) {
3404  $this->debug('cookie is for a different path');
3405  continue;
3406  }
3407  }
3408  if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
3409  $this->debug('cookie is secure, transport is not');
3410  continue;
3411  }
3412  $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
3413  $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
3414  }
3415  }
3416  return $cookie_str;
3417  }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
+ Here is the call graph for this function:

◆ getResponse() [1/2]

soap_transport_http::getResponse ( )

Definition at line 2012 of file nusoap.php.

References $data, nusoap_base\debug(), and nusoap_base\setError().

2012  {
2013  $this->incoming_payload = '';
2014 
2015  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
2016  // loop until headers have been retrieved
2017  $data = '';
2018  while (!isset($lb)){
2019 
2020  // We might EOF during header read.
2021  if(feof($this->fp)) {
2022  $this->incoming_payload = $data;
2023  $this->debug('found no headers before EOF after length ' . strlen($data));
2024  $this->debug("received before EOF:\n" . $data);
2025  $this->setError('server failed to send headers');
2026  return false;
2027  }
2028 
2029  $tmp = fgets($this->fp, 256);
2030  $tmplen = strlen($tmp);
2031  $this->debug("read line of $tmplen bytes: " . trim($tmp));
2032 
2033  if ($tmplen == 0) {
2034  $this->incoming_payload = $data;
2035  $this->debug('socket read of headers timed out after length ' . strlen($data));
2036  $this->debug("read before timeout:\n" . $data);
2037  $this->setError('socket read of headers timed out');
2038  return false;
2039  }
2040 
2041  $data .= $tmp;
2042  $pos = strpos($data,"\r\n\r\n");
2043  if($pos > 1){
2044  $lb = "\r\n";
2045  } else {
2046  $pos = strpos($data,"\n\n");
2047  if($pos > 1){
2048  $lb = "\n";
2049  }
2050  }
2051  // remove 100 header
2052  if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
2053  unset($lb);
2054  $data = '';
2055  }//
2056  }
2057  // store header data
2058  $this->incoming_payload .= $data;
2059  $this->debug('found end of headers after length ' . strlen($data));
2060  // process headers
2061  $header_data = trim(substr($data,0,$pos));
2062  $header_array = explode($lb,$header_data);
2063  $this->incoming_headers = array();
2064  foreach($header_array as $header_line){
2065  $arr = explode(':',$header_line, 2);
2066  if(count($arr) > 1){
2067  $header_name = strtolower(trim($arr[0]));
2068  $this->incoming_headers[$header_name] = trim($arr[1]);
2069  } else if (isset($header_name)) {
2070  $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
2071  }
2072  }
2073 
2074  // loop until msg has been received
2075  if (isset($this->incoming_headers['content-length'])) {
2076  $content_length = $this->incoming_headers['content-length'];
2077  $chunked = false;
2078  $this->debug("want to read content of length $content_length");
2079  } else {
2080  $content_length = 2147483647;
2081  if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
2082  $chunked = true;
2083  $this->debug("want to read chunked content");
2084  } else {
2085  $chunked = false;
2086  $this->debug("want to read content to EOF");
2087  }
2088  }
2089  $data = '';
2090  do {
2091  if ($chunked) {
2092  $tmp = fgets($this->fp, 256);
2093  $tmplen = strlen($tmp);
2094  $this->debug("read chunk line of $tmplen bytes");
2095  if ($tmplen == 0) {
2096  $this->incoming_payload = $data;
2097  $this->debug('socket read of chunk length timed out after length ' . strlen($data));
2098  $this->debug("read before timeout:\n" . $data);
2099  $this->setError('socket read of chunk length timed out');
2100  return false;
2101  }
2102  $content_length = hexdec(trim($tmp));
2103  $this->debug("chunk length $content_length");
2104  }
2105  $strlen = 0;
2106  while (($strlen < $content_length) && (!feof($this->fp))) {
2107  $readlen = min(8192, $content_length - $strlen);
2108  $tmp = fread($this->fp, $readlen);
2109  $tmplen = strlen($tmp);
2110  $this->debug("read buffer of $tmplen bytes");
2111  if (($tmplen == 0) && (!feof($this->fp))) {
2112  $this->incoming_payload = $data;
2113  $this->debug('socket read of body timed out after length ' . strlen($data));
2114  $this->debug("read before timeout:\n" . $data);
2115  $this->setError('socket read of body timed out');
2116  return false;
2117  }
2118  $strlen += $tmplen;
2119  $data .= $tmp;
2120  }
2121  if ($chunked && ($content_length > 0)) {
2122  $tmp = fgets($this->fp, 256);
2123  $tmplen = strlen($tmp);
2124  $this->debug("read chunk terminator of $tmplen bytes");
2125  if ($tmplen == 0) {
2126  $this->incoming_payload = $data;
2127  $this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
2128  $this->debug("read before timeout:\n" . $data);
2129  $this->setError('socket read of chunk terminator timed out');
2130  return false;
2131  }
2132  }
2133  } while ($chunked && ($content_length > 0) && (!feof($this->fp)));
2134  if (feof($this->fp)) {
2135  $this->debug('read to EOF');
2136  }
2137  $this->debug('read body of length ' . strlen($data));
2138  $this->incoming_payload .= $data;
2139  $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
2140 
2141  // close filepointer
2142  if(
2143  (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') ||
2144  (! $this->persistentConnection) || feof($this->fp)){
2145  fclose($this->fp);
2146  $this->fp = false;
2147  $this->debug('closed socket');
2148  }
2149 
2150  // connection was closed unexpectedly
2151  if($this->incoming_payload == ''){
2152  $this->setError('no response from server');
2153  return false;
2154  }
2155 
2156  // decode transfer-encoding
2157 // if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
2158 // if(!$data = $this->decodeChunked($data, $lb)){
2159 // $this->setError('Decoding of chunked data failed');
2160 // return false;
2161 // }
2162  //print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
2163  // set decoded payload
2164 // $this->incoming_payload = $header_data.$lb.$lb.$data;
2165 // }
2166 
2167  } else if ($this->scheme == 'https') {
2168  // send and receive
2169  $this->debug('send and receive with cURL');
2170  $this->incoming_payload = curl_exec($this->ch);
2172 
2173  $cErr = curl_error($this->ch);
2174  if ($cErr != '') {
2175  $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
2176  foreach(curl_getinfo($this->ch) as $k => $v){
2177  $err .= "$k: $v<br>";
2178  }
2179  $this->debug($err);
2180  $this->setError($err);
2181  curl_close($this->ch);
2182  return false;
2183  } else {
2184  //echo '<pre>';
2185  //var_dump(curl_getinfo($this->ch));
2186  //echo '</pre>';
2187  }
2188  // close curl
2189  $this->debug('No cURL error, closing cURL');
2190  curl_close($this->ch);
2191 
2192  // remove 100 header
2193  if (ereg('^HTTP/1.1 100',$data)) {
2194  if ($pos = strpos($data,"\r\n\r\n")) {
2195  $data = ltrim(substr($data,$pos));
2196  } elseif($pos = strpos($data,"\n\n") ) {
2197  $data = ltrim(substr($data,$pos));
2198  }
2199  }
2200 
2201  // separate content from HTTP headers
2202  if ($pos = strpos($data,"\r\n\r\n")) {
2203  $lb = "\r\n";
2204  } elseif( $pos = strpos($data,"\n\n")) {
2205  $lb = "\n";
2206  } else {
2207  $this->debug('no proper separation of headers and document');
2208  $this->setError('no proper separation of headers and document');
2209  return false;
2210  }
2211  $header_data = trim(substr($data,0,$pos));
2212  $header_array = explode($lb,$header_data);
2213  $data = ltrim(substr($data,$pos));
2214  $this->debug('found proper separation of headers and document');
2215  $this->debug('cleaned data, stringlen: '.strlen($data));
2216  // clean headers
2217  foreach ($header_array as $header_line) {
2218  $arr = explode(':',$header_line,2);
2219  if (count($arr) > 1) {
2220  $this->incoming_headers[strtolower(trim($arr[0]))] = trim($arr[1]);
2221  }
2222  }
2223  }
2224 
2225  // see if we need to resend the request with http digest authentication
2226  if (isset($this->incoming_headers['www-authenticate']) && strstr($header_array[0], '401 Unauthorized')) {
2227  $this->debug('Got 401 Unauthorized with WWW-Authenticate: ' . $this->incoming_headers['www-authenticate']);
2228  if (substr("Digest ", $this->incoming_headers['www-authenticate'])) {
2229  $this->debug('Server wants digest authentication');
2230  // remove "Digest " from our elements
2231  $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
2232 
2233  // parse elements into array
2234  $digestElements = explode(',', $digestString);
2235  foreach ($digestElements as $val) {
2236  $tempElement = explode('=', trim($val));
2237  $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]);
2238  }
2239 
2240  // should have (at least) qop, realm, nonce
2241  if (isset($digestRequest['nonce'])) {
2242  $this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
2243  $this->tryagain = true;
2244  return false;
2245  }
2246  }
2247  $this->debug('HTTP authentication failed');
2248  $this->setError('HTTP authentication failed');
2249  return false;
2250  }
2251 
2252  // decode content-encoding
2253  if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
2254  if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
2255  // if decoding works, use it. else assume data wasn't gzencoded
2256  if(function_exists('gzuncompress')){
2257  //$timer->setMarker('starting decoding of gzip/deflated content');
2258  if($this->incoming_headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)){
2259  $data = $degzdata;
2260  } elseif($this->incoming_headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))){ // do our best
2261  $data = $degzdata;
2262  } else {
2263  $this->setError('Errors occurred when trying to decode the data');
2264  }
2265  //$timer->setMarker('finished decoding of gzip/deflated content');
2266  //print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
2267  // set decoded payload
2268  $this->incoming_payload = $header_data.$lb.$lb.$data;
2269  } else {
2270  $this->setError('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
2271  }
2272  }
2273  }
2274 
2275  if(strlen($data) == 0){
2276  $this->debug('no data after headers!');
2277  $this->setError('no data present after HTTP headers');
2278  return false;
2279  }
2280 
2281  return $data;
2282  }
setError($str)
sets error string
Definition: nusoap.php:184
setCredentials($username, $password, $authtype='basic', $digestRequest=array())
if authenticating, set user credentials here
Definition: nusoap.php:1793
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ getResponse() [2/2]

soap_transport_http::getResponse ( )

gets the SOAP response via HTTP[S]

Returns
string the response (also sets member variables like incoming_payload) private

Definition at line 2908 of file nusoap.php.

References $data, nusoap_base\debug(), and nusoap_base\setError().

2908  {
2909  $this->incoming_payload = '';
2910 
2911  if ($this->io_method() == 'socket') {
2912  // loop until headers have been retrieved
2913  $data = '';
2914  while (!isset($lb)){
2915 
2916  // We might EOF during header read.
2917  if(feof($this->fp)) {
2918  $this->incoming_payload = $data;
2919  $this->debug('found no headers before EOF after length ' . strlen($data));
2920  $this->debug("received before EOF:\n" . $data);
2921  $this->setError('server failed to send headers');
2922  return false;
2923  }
2924 
2925  $tmp = fgets($this->fp, 256);
2926  $tmplen = strlen($tmp);
2927  $this->debug("read line of $tmplen bytes: " . trim($tmp));
2928 
2929  if ($tmplen == 0) {
2930  $this->incoming_payload = $data;
2931  $this->debug('socket read of headers timed out after length ' . strlen($data));
2932  $this->debug("read before timeout: " . $data);
2933  $this->setError('socket read of headers timed out');
2934  return false;
2935  }
2936 
2937  $data .= $tmp;
2938  $pos = strpos($data,"\r\n\r\n");
2939  if($pos > 1){
2940  $lb = "\r\n";
2941  } else {
2942  $pos = strpos($data,"\n\n");
2943  if($pos > 1){
2944  $lb = "\n";
2945  }
2946  }
2947  // remove 100 headers
2948  if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) {
2949  unset($lb);
2950  $data = '';
2951  }//
2952  }
2953  // store header data
2954  $this->incoming_payload .= $data;
2955  $this->debug('found end of headers after length ' . strlen($data));
2956  // process headers
2957  $header_data = trim(substr($data,0,$pos));
2958  $header_array = explode($lb,$header_data);
2959  $this->incoming_headers = array();
2960  $this->incoming_cookies = array();
2961  foreach($header_array as $header_line){
2962  $arr = explode(':',$header_line, 2);
2963  if(count($arr) > 1){
2964  $header_name = strtolower(trim($arr[0]));
2965  $this->incoming_headers[$header_name] = trim($arr[1]);
2966  if ($header_name == 'set-cookie') {
2967  // TODO: allow multiple cookies from parseCookie
2968  $cookie = $this->parseCookie(trim($arr[1]));
2969  if ($cookie) {
2970  $this->incoming_cookies[] = $cookie;
2971  $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
2972  } else {
2973  $this->debug('did not find cookie in ' . trim($arr[1]));
2974  }
2975  }
2976  } else if (isset($header_name)) {
2977  // append continuation line to previous header
2978  $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
2979  }
2980  }
2981 
2982  // loop until msg has been received
2983  if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
2984  $content_length = 2147483647; // ignore any content-length header
2985  $chunked = true;
2986  $this->debug("want to read chunked content");
2987  } elseif (isset($this->incoming_headers['content-length'])) {
2988  $content_length = $this->incoming_headers['content-length'];
2989  $chunked = false;
2990  $this->debug("want to read content of length $content_length");
2991  } else {
2992  $content_length = 2147483647;
2993  $chunked = false;
2994  $this->debug("want to read content to EOF");
2995  }
2996  $data = '';
2997  do {
2998  if ($chunked) {
2999  $tmp = fgets($this->fp, 256);
3000  $tmplen = strlen($tmp);
3001  $this->debug("read chunk line of $tmplen bytes");
3002  if ($tmplen == 0) {
3003  $this->incoming_payload = $data;
3004  $this->debug('socket read of chunk length timed out after length ' . strlen($data));
3005  $this->debug("read before timeout:\n" . $data);
3006  $this->setError('socket read of chunk length timed out');
3007  return false;
3008  }
3009  $content_length = hexdec(trim($tmp));
3010  $this->debug("chunk length $content_length");
3011  }
3012  $strlen = 0;
3013  while (($strlen < $content_length) && (!feof($this->fp))) {
3014  $readlen = min(8192, $content_length - $strlen);
3015  $tmp = fread($this->fp, $readlen);
3016  $tmplen = strlen($tmp);
3017  $this->debug("read buffer of $tmplen bytes");
3018  if (($tmplen == 0) && (!feof($this->fp))) {
3019  $this->incoming_payload = $data;
3020  $this->debug('socket read of body timed out after length ' . strlen($data));
3021  $this->debug("read before timeout:\n" . $data);
3022  $this->setError('socket read of body timed out');
3023  return false;
3024  }
3025  $strlen += $tmplen;
3026  $data .= $tmp;
3027  }
3028  if ($chunked && ($content_length > 0)) {
3029  $tmp = fgets($this->fp, 256);
3030  $tmplen = strlen($tmp);
3031  $this->debug("read chunk terminator of $tmplen bytes");
3032  if ($tmplen == 0) {
3033  $this->incoming_payload = $data;
3034  $this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
3035  $this->debug("read before timeout:\n" . $data);
3036  $this->setError('socket read of chunk terminator timed out');
3037  return false;
3038  }
3039  }
3040  } while ($chunked && ($content_length > 0) && (!feof($this->fp)));
3041  if (feof($this->fp)) {
3042  $this->debug('read to EOF');
3043  }
3044  $this->debug('read body of length ' . strlen($data));
3045  $this->incoming_payload .= $data;
3046  $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
3047 
3048  // close filepointer
3049  if(
3050  (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') ||
3051  (! $this->persistentConnection) || feof($this->fp)){
3052  fclose($this->fp);
3053  $this->fp = false;
3054  $this->debug('closed socket');
3055  }
3056 
3057  // connection was closed unexpectedly
3058  if($this->incoming_payload == ''){
3059  $this->setError('no response from server');
3060  return false;
3061  }
3062 
3063  // decode transfer-encoding
3064 // if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
3065 // if(!$data = $this->decodeChunked($data, $lb)){
3066 // $this->setError('Decoding of chunked data failed');
3067 // return false;
3068 // }
3069  //print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
3070  // set decoded payload
3071 // $this->incoming_payload = $header_data.$lb.$lb.$data;
3072 // }
3073 
3074  } else if ($this->io_method() == 'curl') {
3075  // send and receive
3076  $this->debug('send and receive with cURL');
3077  $this->incoming_payload = curl_exec($this->ch);
3079 
3080  $cErr = curl_error($this->ch);
3081  if ($cErr != '') {
3082  $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
3083  // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
3084  foreach(curl_getinfo($this->ch) as $k => $v){
3085  $err .= "$k: $v<br>";
3086  }
3087  $this->debug($err);
3088  $this->setError($err);
3089  curl_close($this->ch);
3090  return false;
3091  } else {
3092  //echo '<pre>';
3093  //var_dump(curl_getinfo($this->ch));
3094  //echo '</pre>';
3095  }
3096  // close curl
3097  $this->debug('No cURL error, closing cURL');
3098  curl_close($this->ch);
3099 
3100  // try removing skippable headers
3101  $savedata = $data;
3102  while ($this->isSkippableCurlHeader($data)) {
3103  $this->debug("Found HTTP header to skip");
3104  if ($pos = strpos($data,"\r\n\r\n")) {
3105  $data = ltrim(substr($data,$pos));
3106  } elseif($pos = strpos($data,"\n\n") ) {
3107  $data = ltrim(substr($data,$pos));
3108  }
3109  }
3110 
3111  if ($data == '') {
3112  // have nothing left; just remove 100 header(s)
3113  $data = $savedata;
3114  while (preg_match('/^HTTP\/1.1 100/',$data)) {
3115  if ($pos = strpos($data,"\r\n\r\n")) {
3116  $data = ltrim(substr($data,$pos));
3117  } elseif($pos = strpos($data,"\n\n") ) {
3118  $data = ltrim(substr($data,$pos));
3119  }
3120  }
3121  }
3122 
3123  // separate content from HTTP headers
3124  if ($pos = strpos($data,"\r\n\r\n")) {
3125  $lb = "\r\n";
3126  } elseif( $pos = strpos($data,"\n\n")) {
3127  $lb = "\n";
3128  } else {
3129  $this->debug('no proper separation of headers and document');
3130  $this->setError('no proper separation of headers and document');
3131  return false;
3132  }
3133  $header_data = trim(substr($data,0,$pos));
3134  $header_array = explode($lb,$header_data);
3135  $data = ltrim(substr($data,$pos));
3136  $this->debug('found proper separation of headers and document');
3137  $this->debug('cleaned data, stringlen: '.strlen($data));
3138  // clean headers
3139  foreach ($header_array as $header_line) {
3140  $arr = explode(':',$header_line,2);
3141  if(count($arr) > 1){
3142  $header_name = strtolower(trim($arr[0]));
3143  $this->incoming_headers[$header_name] = trim($arr[1]);
3144  if ($header_name == 'set-cookie') {
3145  // TODO: allow multiple cookies from parseCookie
3146  $cookie = $this->parseCookie(trim($arr[1]));
3147  if ($cookie) {
3148  $this->incoming_cookies[] = $cookie;
3149  $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3150  } else {
3151  $this->debug('did not find cookie in ' . trim($arr[1]));
3152  }
3153  }
3154  } else if (isset($header_name)) {
3155  // append continuation line to previous header
3156  $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3157  }
3158  }
3159  }
3160 
3161  $this->response_status_line = $header_array[0];
3162  $arr = explode(' ', $this->response_status_line, 3);
3163  $http_version = $arr[0];
3164  $http_status = intval($arr[1]);
3165  $http_reason = count($arr) > 2 ? $arr[2] : '';
3166 
3167  // see if we need to resend the request with http digest authentication
3168  if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) {
3169  $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']);
3170  $this->setURL($this->incoming_headers['location']);
3171  $this->tryagain = true;
3172  return false;
3173  }
3174 
3175  // see if we need to resend the request with http digest authentication
3176  if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
3177  $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
3178  if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
3179  $this->debug('Server wants digest authentication');
3180  // remove "Digest " from our elements
3181  $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
3182 
3183  // parse elements into array
3184  $digestElements = explode(',', $digestString);
3185  foreach ($digestElements as $val) {
3186  $tempElement = explode('=', trim($val), 2);
3187  $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]);
3188  }
3189 
3190  // should have (at least) qop, realm, nonce
3191  if (isset($digestRequest['nonce'])) {
3192  $this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
3193  $this->tryagain = true;
3194  return false;
3195  }
3196  }
3197  $this->debug('HTTP authentication failed');
3198  $this->setError('HTTP authentication failed');
3199  return false;
3200  }
3201 
3202  if (
3203  ($http_status >= 300 && $http_status <= 307) ||
3204  ($http_status >= 400 && $http_status <= 417) ||
3205  ($http_status >= 501 && $http_status <= 505)
3206  ) {
3207  $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)");
3208  return false;
3209  }
3210 
3211  // decode content-encoding
3212  if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
3213  if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
3214  // if decoding works, use it. else assume data wasn't gzencoded
3215  if(function_exists('gzinflate')){
3216  //$timer->setMarker('starting decoding of gzip/deflated content');
3217  // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
3218  // this means there are no Zlib headers, although there should be
3219  $this->debug('The gzinflate function exists');
3220  $datalen = strlen($data);
3221  if ($this->incoming_headers['content-encoding'] == 'deflate') {
3222  if ($degzdata = @gzinflate($data)) {
3223  $data = $degzdata;
3224  $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
3225  if (strlen($data) < $datalen) {
3226  // test for the case that the payload has been compressed twice
3227  $this->debug('The inflated payload is smaller than the gzipped one; try again');
3228  if ($degzdata = @gzinflate($data)) {
3229  $data = $degzdata;
3230  $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
3231  }
3232  }
3233  } else {
3234  $this->debug('Error using gzinflate to inflate the payload');
3235  $this->setError('Error using gzinflate to inflate the payload');
3236  }
3237  } elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
3238  if ($degzdata = @gzinflate(substr($data, 10))) { // do our best
3239  $data = $degzdata;
3240  $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
3241  if (strlen($data) < $datalen) {
3242  // test for the case that the payload has been compressed twice
3243  $this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
3244  if ($degzdata = @gzinflate(substr($data, 10))) {
3245  $data = $degzdata;
3246  $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
3247  }
3248  }
3249  } else {
3250  $this->debug('Error using gzinflate to un-gzip the payload');
3251  $this->setError('Error using gzinflate to un-gzip the payload');
3252  }
3253  }
3254  //$timer->setMarker('finished decoding of gzip/deflated content');
3255  //print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
3256  // set decoded payload
3257  $this->incoming_payload = $header_data.$lb.$lb.$data;
3258  } else {
3259  $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
3260  $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
3261  }
3262  } else {
3263  $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
3264  $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
3265  }
3266  } else {
3267  $this->debug('No Content-Encoding header');
3268  }
3269 
3270  if(strlen($data) == 0){
3271  $this->debug('no data after headers!');
3272  $this->setError('no data present after HTTP headers');
3273  return false;
3274  }
3275 
3276  return $data;
3277  }
setError($str)
sets error string
Definition: nusoap.php:184
setCredentials($username, $password, $authtype='basic', $digestRequest=array())
if authenticating, set user credentials here
Definition: nusoap.php:1793
setURL($url)
sets the URL to which to connect
Definition: nusoap.php:2233
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
isSkippableCurlHeader(&$data)
Test if the given string starts with a header that is to be skipped.
Definition: nusoap.php:2720
parseCookie($cookie_str)
parse an incoming Cookie into it&#39;s parts
Definition: nusoap.php:3316
io_method()
gets the I/O method to use
Definition: nusoap.php:2277
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ io_method()

soap_transport_http::io_method ( )

gets the I/O method to use

Returns
string I/O method to use (socket|curl|unknown) private

Definition at line 2277 of file nusoap.php.

2277  {
2278  if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm'))
2279  return 'curl';
2280  if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm'))
2281  return 'socket';
2282  return 'unknown';
2283  }

◆ isSkippableCurlHeader()

soap_transport_http::isSkippableCurlHeader ( $data)

Test if the given string starts with a header that is to be skipped.

Skippable headers result from chunked transfer and proxy requests.

Parameters
string$dataThe string to check.
Returns
boolean Whether a skippable header was found. private

Definition at line 2720 of file nusoap.php.

References $data.

2720  {
2721  $skipHeaders = array( 'HTTP/1.1 100',
2722  'HTTP/1.0 301',
2723  'HTTP/1.1 301',
2724  'HTTP/1.0 302',
2725  'HTTP/1.1 302',
2726  'HTTP/1.0 401',
2727  'HTTP/1.1 401',
2728  'HTTP/1.0 200 Connection established');
2729  foreach ($skipHeaders as $hd) {
2730  $prefix = substr($data, 0, strlen($hd));
2731  if ($prefix == $hd) return true;
2732  }
2733 
2734  return false;
2735  }
$data
Definition: bench.php:6

◆ parseCookie()

soap_transport_http::parseCookie (   $cookie_str)

parse an incoming Cookie into it's parts

Parameters
string$cookie_strcontent of cookie
Returns
array with data of that cookie private

Definition at line 3316 of file nusoap.php.

References $data, $domain, $name, $start, and Sabre\Uri\split().

3316  {
3317  $cookie_str = str_replace('; ', ';', $cookie_str) . ';';
3318  $data = split(';', $cookie_str);
3319  $value_str = $data[0];
3320 
3321  $cookie_param = 'domain=';
3322  $start = strpos($cookie_str, $cookie_param);
3323  if ($start > 0) {
3324  $domain = substr($cookie_str, $start + strlen($cookie_param));
3325  $domain = substr($domain, 0, strpos($domain, ';'));
3326  } else {
3327  $domain = '';
3328  }
3329 
3330  $cookie_param = 'expires=';
3331  $start = strpos($cookie_str, $cookie_param);
3332  if ($start > 0) {
3333  $expires = substr($cookie_str, $start + strlen($cookie_param));
3334  $expires = substr($expires, 0, strpos($expires, ';'));
3335  } else {
3336  $expires = '';
3337  }
3338 
3339  $cookie_param = 'path=';
3340  $start = strpos($cookie_str, $cookie_param);
3341  if ( $start > 0 ) {
3342  $path = substr($cookie_str, $start + strlen($cookie_param));
3343  $path = substr($path, 0, strpos($path, ';'));
3344  } else {
3345  $path = '/';
3346  }
3347 
3348  $cookie_param = ';secure;';
3349  if (strpos($cookie_str, $cookie_param) !== FALSE) {
3350  $secure = true;
3351  } else {
3352  $secure = false;
3353  }
3354 
3355  $sep_pos = strpos($value_str, '=');
3356 
3357  if ($sep_pos) {
3358  $name = substr($value_str, 0, $sep_pos);
3359  $value = substr($value_str, $sep_pos + 1);
3360  $cookie= array( 'name' => $name,
3361  'value' => $value,
3362  'domain' => $domain,
3363  'path' => $path,
3364  'expires' => $expires,
3365  'secure' => $secure
3366  );
3367  return $cookie;
3368  }
3369  return false;
3370  }
split($path)
Returns the &#39;dirname&#39; and &#39;basename&#39; for a path.
Definition: functions.php:279
$start
Definition: bench.php:8
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ send() [1/2]

soap_transport_http::send (   $data,
  $timeout = 0,
  $response_timeout = 30 
)

send the SOAP message via HTTP

Parameters
string$datamessage data
integer$timeoutset connection timeout in seconds
integer$response_timeoutset response timeout in seconds
Returns
string data public

Definition at line 1741 of file nusoap.php.

References $data, nusoap_base\debug(), and nusoap_base\setError().

1741  {
1742 
1743  $this->debug('entered send() with data of length: '.strlen($data));
1744 
1745  $this->tryagain = true;
1746  $tries = 0;
1747  while ($this->tryagain) {
1748  $this->tryagain = false;
1749  if ($tries++ < 2) {
1750  // make connnection
1751  if (!$this->connect($timeout, $response_timeout)){
1752  return false;
1753  }
1754 
1755  // send request
1756  if (!$this->sendRequest($data)){
1757  return false;
1758  }
1759 
1760  // get response
1761  $respdata = $this->getResponse();
1762  } else {
1763  $this->setError('Too many tries to get an OK response');
1764  }
1765  }
1766  $this->debug('end of send()');
1767  return $respdata;
1768  }
connect($connection_timeout=0, $response_timeout=30)
Definition: nusoap.php:1615
setError($str)
sets error string
Definition: nusoap.php:184
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ send() [2/2]

soap_transport_http::send (   $data,
  $timeout = 0,
  $response_timeout = 30,
  $cookies = NULL 
)

sends the SOAP request and gets the SOAP response via HTTP[S]

Parameters
string$datamessage data
integer$timeoutset connection timeout in seconds
integer$response_timeoutset response timeout in seconds
array$cookiescookies to send
Returns
string data public

Definition at line 2529 of file nusoap.php.

References $data, nusoap_base\debug(), and nusoap_base\setError().

2529  {
2530 
2531  $this->debug('entered send() with data of length: '.strlen($data));
2532 
2533  $this->tryagain = true;
2534  $tries = 0;
2535  while ($this->tryagain) {
2536  $this->tryagain = false;
2537  if ($tries++ < 2) {
2538  // make connnection
2539  if (!$this->connect($timeout, $response_timeout)){
2540  return false;
2541  }
2542 
2543  // send request
2544  if (!$this->sendRequest($data, $cookies)){
2545  return false;
2546  }
2547 
2548  // get response
2549  $respdata = $this->getResponse();
2550  } else {
2551  $this->setError("Too many tries to get an OK response ($this->response_status_line)");
2552  }
2553  }
2554  $this->debug('end of send()');
2555  return $respdata;
2556  }
connect($connection_timeout=0, $response_timeout=30)
Definition: nusoap.php:1615
setError($str)
sets error string
Definition: nusoap.php:184
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ sendHTTPS() [1/2]

soap_transport_http::sendHTTPS (   $data,
  $timeout = 0,
  $response_timeout = 30 
)

send the SOAP message via HTTPS 1.0 using CURL

Parameters
string$msgmessage data
integer$timeoutset connection timeout in seconds
integer$response_timeoutset response timeout in seconds
Returns
string data public

Definition at line 1780 of file nusoap.php.

References $data.

1780  {
1781  return $this->send($data, $timeout, $response_timeout);
1782  }
send($data, $timeout=0, $response_timeout=30)
send the SOAP message via HTTP
Definition: nusoap.php:1741
$data
Definition: bench.php:6

◆ sendHTTPS() [2/2]

soap_transport_http::sendHTTPS (   $data,
  $timeout = 0,
  $response_timeout = 30,
  $cookies 
)

sends the SOAP request and gets the SOAP response via HTTPS using CURL

Parameters
string$datamessage data
integer$timeoutset connection timeout in seconds
integer$response_timeoutset response timeout in seconds
array$cookiescookies to send
Returns
string data public
Deprecated:

Definition at line 2570 of file nusoap.php.

References $data.

2570  {
2571  return $this->send($data, $timeout, $response_timeout, $cookies);
2572  }
send($data, $timeout=0, $response_timeout=30)
send the SOAP message via HTTP
Definition: nusoap.php:1741
$data
Definition: bench.php:6

◆ sendRequest() [1/2]

soap_transport_http::sendRequest (   $data)

Definition at line 1979 of file nusoap.php.

References $data, nusoap_base\debug(), and nusoap_base\setError().

1979  {
1980  // build payload
1981  $this->buildPayload($data);
1982 
1983  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
1984  // send payload
1985  if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
1986  $this->setError('couldn\'t write message data to socket');
1987  $this->debug('couldn\'t write message data to socket');
1988  return false;
1989  }
1990  $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
1991  return true;
1992  } else if ($this->scheme == 'https') {
1993  // set payload
1994  // TODO: cURL does say this should only be the verb, and in fact it
1995  // turns out that the URI and HTTP version are appended to this, which
1996  // some servers refuse to work with
1997  //curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
1998  foreach($this->outgoing_headers as $k => $v){
1999  $curl_headers[] = "$k: $v";
2000  }
2001  curl_setopt($this->ch, CURLOPT_HTTPHEADER, $curl_headers);
2002  if ($this->request_method == "POST") {
2003  curl_setopt($this->ch, CURLOPT_POST, 1);
2004  curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
2005  } else {
2006  }
2007  $this->debug('set cURL payload');
2008  return true;
2009  }
2010  }
setError($str)
sets error string
Definition: nusoap.php:184
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ sendRequest() [2/2]

soap_transport_http::sendRequest (   $data,
  $cookies = NULL 
)

sends the SOAP request via HTTP[S]

Parameters
string$datamessage data
array$cookiescookies to send
Returns
boolean true if OK, false if problem private

Definition at line 2851 of file nusoap.php.

References $data, $key, nusoap_base\debug(), and nusoap_base\setError().

2851  {
2852  // build cookie string
2853  $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
2854 
2855  // build payload
2856  $this->buildPayload($data, $cookie_str);
2857 
2858  if ($this->io_method() == 'socket') {
2859  // send payload
2860  if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
2861  $this->setError('couldn\'t write message data to socket');
2862  $this->debug('couldn\'t write message data to socket');
2863  return false;
2864  }
2865  $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
2866  return true;
2867  } else if ($this->io_method() == 'curl') {
2868  // set payload
2869  // cURL does say this should only be the verb, and in fact it
2870  // turns out that the URI and HTTP version are appended to this, which
2871  // some servers refuse to work with (so we no longer use this method!)
2872  //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
2873  $curl_headers = array();
2874  foreach($this->outgoing_headers as $k => $v){
2875  if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') {
2876  $this->debug("Skip cURL header $k: $v");
2877  } else {
2878  $curl_headers[] = "$k: $v";
2879  }
2880  }
2881  if ($cookie_str != '') {
2882  $curl_headers[] = 'Cookie: ' . $cookie_str;
2883  }
2884  $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers);
2885  $this->debug('set cURL HTTP headers');
2886  if ($this->request_method == "POST") {
2887  $this->setCurlOption(CURLOPT_POST, 1);
2888  $this->setCurlOption(CURLOPT_POSTFIELDS, $data);
2889  $this->debug('set cURL POST data');
2890  } else {
2891  }
2892  // insert custom user-set cURL options
2893  foreach ($this->ch_options as $key => $val) {
2894  $this->setCurlOption($key, $val);
2895  }
2896 
2897  $this->debug('set cURL payload');
2898  return true;
2899  }
2900  }
setError($str)
sets error string
Definition: nusoap.php:184
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
setCurlOption($option, $value)
sets a cURL option
Definition: nusoap.php:2196
getCookiesForRequest($cookies, $secure=false)
sort out cookies for the current request
Definition: nusoap.php:3380
io_method()
gets the I/O method to use
Definition: nusoap.php:2277
$key
Definition: croninfo.php:18
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ setContentType() [1/2]

soap_transport_http::setContentType (   $type,
  $charset = false 
)

Definition at line 2284 of file nusoap.php.

References $type.

2284  {
2285  $this->outgoing_headers['Content-Type'] = $type . ($charset ? '; charset=' . $charset : '');
2286  }
$type

◆ setContentType() [2/2]

soap_transport_http::setContentType (   $type,
  $charset = false 
)

sets the content-type for the SOAP message to be sent

Parameters
string$typethe content type, MIME style
mixed$charsetcharacter set used for encoding (or false) public

Definition at line 3286 of file nusoap.php.

References $type, and Sabre\HTTP\setHeader().

3286  {
3287  $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : ''));
3288  }
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
$type
+ Here is the call graph for this function:

◆ setCredentials() [1/2]

soap_transport_http::setCredentials (   $username,
  $password,
  $authtype = 'basic',
  $digestRequest = array() 
)

if authenticating, set user credentials here

Parameters
string$username
string$password
string$authtype
array$digestRequestpublic

Definition at line 1793 of file nusoap.php.

References $_SERVER, $password, and nusoap_base\debug().

1793  {
1794  global $_SERVER;
1795 
1796  $this->debug("Set credentials for authtype $authtype");
1797  // cf. RFC 2617
1798  if ($authtype == 'basic') {
1799  $this->outgoing_headers['Authorization'] = 'Basic '.base64_encode($username.':'.$password);
1800  } elseif ($authtype == 'digest') {
1801  if (isset($digestRequest['nonce'])) {
1802  $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
1803 
1804  // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
1805 
1806  // A1 = unq(username-value) ":" unq(realm-value) ":" passwd
1807  $A1 = $username. ':' . $digestRequest['realm'] . ':' . $password;
1808 
1809  // H(A1) = MD5(A1)
1810  $HA1 = md5($A1);
1811 
1812  // A2 = Method ":" digest-uri-value
1813  $A2 = 'POST:' . $this->uri;
1814 
1815  // H(A2)
1816  $HA2 = md5($A2);
1817 
1818  // KD(secret, data) = H(concat(secret, ":", data))
1819  // if qop == auth:
1820  // request-digest = <"> < KD ( H(A1), unq(nonce-value)
1821  // ":" nc-value
1822  // ":" unq(cnonce-value)
1823  // ":" unq(qop-value)
1824  // ":" H(A2)
1825  // ) <">
1826  // if qop is missing,
1827  // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
1828 
1829  $unhashedDigest = '';
1830  $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
1831  $cnonce = $nonce;
1832  if ($digestRequest['qop'] != '') {
1833  $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
1834  } else {
1835  $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
1836  }
1837 
1838  $hashedDigest = md5($unhashedDigest);
1839 
1840  $this->outgoing_headers['Authorization'] = 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->uri . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"';
1841  }
1842  }
1843  $this->username = $username;
1844  $this->password = $password;
1845  $this->authtype = $authtype;
1846  $this->digestRequest = $digestRequest;
1847 
1848  if (isset($this->outgoing_headers['Authorization'])) {
1849  $this->debug('Authorization header set: ' . substr($this->outgoing_headers['Authorization'], 0, 12) . '...');
1850  } else {
1851  $this->debug('Authorization header not set');
1852  }
1853  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ setCredentials() [2/2]

soap_transport_http::setCredentials (   $username,
  $password,
  $authtype = 'basic',
  $digestRequest = array(),
  $certRequest = array() 
)

if authenticating, set user credentials here

Parameters
string$username
string$password
string$authtype(basic|digest|certificate|ntlm)
array$digestRequest(keys must be nonce, nc, realm, qop)
array$certRequest(keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) public

Definition at line 2584 of file nusoap.php.

References $password, nusoap_base\appendDebug(), nusoap_base\debug(), Sabre\HTTP\setHeader(), and nusoap_base\varDump().

2584  {
2585  $this->debug("setCredentials username=$username authtype=$authtype digestRequest=");
2586  $this->appendDebug($this->varDump($digestRequest));
2587  $this->debug("certRequest=");
2588  $this->appendDebug($this->varDump($certRequest));
2589  // cf. RFC 2617
2590  if ($authtype == 'basic') {
2591  $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password));
2592  } elseif ($authtype == 'digest') {
2593  if (isset($digestRequest['nonce'])) {
2594  $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
2595 
2596  // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
2597 
2598  // A1 = unq(username-value) ":" unq(realm-value) ":" passwd
2599  $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
2600 
2601  // H(A1) = MD5(A1)
2602  $HA1 = md5($A1);
2603 
2604  // A2 = Method ":" digest-uri-value
2605  $A2 = $this->request_method . ':' . $this->digest_uri;
2606 
2607  // H(A2)
2608  $HA2 = md5($A2);
2609 
2610  // KD(secret, data) = H(concat(secret, ":", data))
2611  // if qop == auth:
2612  // request-digest = <"> < KD ( H(A1), unq(nonce-value)
2613  // ":" nc-value
2614  // ":" unq(cnonce-value)
2615  // ":" unq(qop-value)
2616  // ":" H(A2)
2617  // ) <">
2618  // if qop is missing,
2619  // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
2620 
2621  $unhashedDigest = '';
2622  $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
2623  $cnonce = $nonce;
2624  if ($digestRequest['qop'] != '') {
2625  $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
2626  } else {
2627  $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
2628  }
2629 
2630  $hashedDigest = md5($unhashedDigest);
2631 
2632  $opaque = '';
2633  if (isset($digestRequest['opaque'])) {
2634  $opaque = ', opaque="' . $digestRequest['opaque'] . '"';
2635  }
2636 
2637  $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"');
2638  }
2639  } elseif ($authtype == 'certificate') {
2640  $this->certRequest = $certRequest;
2641  $this->debug('Authorization header not set for certificate');
2642  } elseif ($authtype == 'ntlm') {
2643  // do nothing
2644  $this->debug('Authorization header not set for ntlm');
2645  }
2646  $this->username = $username;
2647  $this->password = $password;
2648  $this->authtype = $authtype;
2649  $this->digestRequest = $digestRequest;
2650  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
varDump($data)
Definition: nusoap.php:567
+ Here is the call graph for this function:

◆ setCurlOption()

soap_transport_http::setCurlOption (   $option,
  $value 
)

sets a cURL option

Parameters
mixed$optionThe cURL option (always integer?)
mixed$valueThe cURL option value private

Definition at line 2196 of file nusoap.php.

References nusoap_base\appendDebug(), nusoap_base\debug(), and nusoap_base\varDump().

2196  {
2197  $this->debug("setCurlOption option=$option, value=");
2198  $this->appendDebug($this->varDump($value));
2199  curl_setopt($this->ch, $option, $value);
2200  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
varDump($data)
Definition: nusoap.php:567
+ Here is the call graph for this function:

◆ setEncoding() [1/2]

soap_transport_http::setEncoding (   $enc = 'gzip,
deflate'   
)

use http encoding

Parameters
string$encencoding style. supported values: gzip, deflate, or both public

Definition at line 1871 of file nusoap.php.

1871  {
1872  $this->protocol_version = '1.1';
1873  $this->outgoing_headers['Accept-Encoding'] = $enc;
1874  $this->outgoing_headers['Connection'] = 'close';
1875  $this->persistentConnection = false;
1876  #set_magic_quotes_runtime(0);
1877  // deprecated
1878  $this->encoding = $enc;
1879  }

◆ setEncoding() [2/2]

soap_transport_http::setEncoding (   $enc = 'gzip,
deflate'   
)

use http encoding

Parameters
string$encencoding style. supported values: gzip, deflate, or both public

Definition at line 2668 of file nusoap.php.

References Sabre\HTTP\setHeader().

2668  {
2669  if (function_exists('gzdeflate')) {
2670  $this->protocol_version = '1.1';
2671  $this->setHeader('Accept-Encoding', $enc);
2672  if (!isset($this->outgoing_headers['Connection'])) {
2673  $this->setHeader('Connection', 'close');
2674  $this->persistentConnection = false;
2675  }
2676  #set_magic_quotes_runtime(0);
2677  // deprecated
2678  $this->encoding = $enc;
2679  }
2680  }
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
+ Here is the call graph for this function:

◆ setHeader()

soap_transport_http::setHeader (   $name,
  $value 
)

sets an HTTP header

Parameters
string$nameThe name of the header
string$valueThe value of the header private

Definition at line 2209 of file nusoap.php.

References $name, and nusoap_base\debug().

2209  {
2210  $this->outgoing_headers[$name] = $value;
2211  $this->debug("set header $name: $value");
2212  }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ setProxy() [1/2]

soap_transport_http::setProxy (   $proxyhost,
  $proxyport,
  $proxyusername = '',
  $proxypassword = '' 
)

set proxy info here

Parameters
string$proxyhost
string$proxyport
string$proxyusername
string$proxypasswordpublic

Definition at line 1890 of file nusoap.php.

References $url.

1890  {
1891  $this->uri = $this->url;
1892  $this->host = $proxyhost;
1893  $this->port = $proxyport;
1894  if ($proxyusername != '' && $proxypassword != '') {
1895  $this->outgoing_headers['Proxy-Authorization'] = ' Basic '.base64_encode($proxyusername.':'.$proxypassword);
1896  }
1897  }

◆ setProxy() [2/2]

soap_transport_http::setProxy (   $proxyhost,
  $proxyport,
  $proxyusername = '',
  $proxypassword = '',
  $proxyauthtype = 'basic' 
)

set proxy info here

Parameters
string$proxyhostuse an empty string to remove proxy
string$proxyport
string$proxyusername
string$proxypassword
string$proxyauthtype(basic|ntlm) public

Definition at line 2692 of file nusoap.php.

References nusoap_base\debug(), and Sabre\HTTP\setHeader().

2692  {
2693  if ($proxyhost) {
2694  $this->proxy = array(
2695  'host' => $proxyhost,
2696  'port' => $proxyport,
2697  'username' => $proxyusername,
2698  'password' => $proxypassword,
2699  'authtype' => $proxyauthtype
2700  );
2701  if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') {
2702  $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword));
2703  }
2704  } else {
2705  $this->debug('remove proxy');
2706  $proxy = null;
2707  unsetHeader('Proxy-Authorization');
2708  }
2709  }
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
unsetHeader($name)
unsets an HTTP header
Definition: nusoap.php:2220
+ Here is the call graph for this function:

◆ setSOAPAction() [1/2]

soap_transport_http::setSOAPAction (   $soapaction)

set the soapaction value

Parameters
string$soapactionpublic

Definition at line 1861 of file nusoap.php.

1861  {
1862  $this->outgoing_headers['SOAPAction'] = '"' . $soapaction . '"';
1863  }

◆ setSOAPAction() [2/2]

soap_transport_http::setSOAPAction (   $soapaction)

set the soapaction value

Parameters
string$soapactionpublic

Definition at line 2658 of file nusoap.php.

References Sabre\HTTP\setHeader().

2658  {
2659  $this->setHeader('SOAPAction', '"' . $soapaction . '"');
2660  }
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
+ Here is the call graph for this function:

◆ setURL()

soap_transport_http::setURL (   $url)

sets the URL to which to connect

Parameters
string$urlThe URL to which to connect private

Definition at line 2233 of file nusoap.php.

References $path, $url, nusoap_base\debug(), and Sabre\HTTP\setHeader().

2233  {
2234  $this->url = $url;
2235 
2236  $u = parse_url($url);
2237  foreach($u as $k => $v){
2238  $this->debug("parsed URL $k = $v");
2239  $this->$k = $v;
2240  }
2241 
2242  // add any GET params to path
2243  if(isset($u['query']) && $u['query'] != ''){
2244  $this->path .= '?' . $u['query'];
2245  }
2246 
2247  // set default port
2248  if(!isset($u['port'])){
2249  if($u['scheme'] == 'https'){
2250  $this->port = 443;
2251  } else {
2252  $this->port = 80;
2253  }
2254  }
2255 
2256  $this->uri = $this->path;
2257  $this->digest_uri = $this->uri;
2258 
2259  // build headers
2260  if (!isset($u['port'])) {
2261  $this->setHeader('Host', $this->host);
2262  } else {
2263  $this->setHeader('Host', $this->host.':'.$this->port);
2264  }
2265 
2266  if (isset($u['user']) && $u['user'] != '') {
2267  $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
2268  }
2269  }
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
setCredentials($username, $password, $authtype='basic', $digestRequest=array())
if authenticating, set user credentials here
Definition: nusoap.php:1793
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ soap_transport_http()

soap_transport_http::soap_transport_http (   $url)

constructor

Definition at line 1576 of file nusoap.php.

References $path, $url, and nusoap_base\debug().

1576  {
1577  $this->url = $url;
1578 
1579  $u = parse_url($url);
1580  foreach($u as $k => $v){
1581  $this->debug("$k = $v");
1582  $this->$k = $v;
1583  }
1584 
1585  // add any GET params to path
1586  if(isset($u['query']) && $u['query'] != ''){
1587  $this->path .= '?' . $u['query'];
1588  }
1589 
1590  // set default port
1591  if(!isset($u['port'])){
1592  if($u['scheme'] == 'https'){
1593  $this->port = 443;
1594  } else {
1595  $this->port = 80;
1596  }
1597  }
1598 
1599  $this->uri = $this->path;
1600 
1601  // build headers
1602  ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
1603  $this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
1604  if (!isset($u['port'])) {
1605  $this->outgoing_headers['Host'] = $this->host;
1606  } else {
1607  $this->outgoing_headers['Host'] = $this->host.':'.$this->port;
1608  }
1609 
1610  if (isset($u['user']) && $u['user'] != '') {
1611  $this->setCredentials($u['user'], isset($u['pass']) ? $u['pass'] : '');
1612  }
1613  }
setCredentials($username, $password, $authtype='basic', $digestRequest=array())
if authenticating, set user credentials here
Definition: nusoap.php:1793
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ unsetHeader()

soap_transport_http::unsetHeader (   $name)

unsets an HTTP header

Parameters
string$nameThe name of the header private

Definition at line 2220 of file nusoap.php.

References $name, and nusoap_base\debug().

2220  {
2221  if (isset($this->outgoing_headers[$name])) {
2222  $this->debug("unset header $name");
2223  unset($this->outgoing_headers[$name]);
2224  }
2225  }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ usePersistentConnection() [1/2]

soap_transport_http::usePersistentConnection ( )

Definition at line 2288 of file nusoap.php.

2288  {
2289  if (isset($this->outgoing_headers['Accept-Encoding'])) {
2290  return false;
2291  }
2292  $this->protocol_version = '1.1';
2293  $this->persistentConnection = true;
2294  $this->outgoing_headers['Connection'] = 'Keep-Alive';
2295  return true;
2296  }

◆ usePersistentConnection() [2/2]

soap_transport_http::usePersistentConnection ( )

specifies that an HTTP persistent connection should be used

Returns
boolean whether the request was honored by this method. public

Definition at line 3296 of file nusoap.php.

References Sabre\HTTP\setHeader().

3296  {
3297  if (isset($this->outgoing_headers['Accept-Encoding'])) {
3298  return false;
3299  }
3300  $this->protocol_version = '1.1';
3301  $this->persistentConnection = true;
3302  $this->setHeader('Connection', 'Keep-Alive');
3303  return true;
3304  }
setHeader($name, $value)
sets an HTTP header
Definition: nusoap.php:2209
+ Here is the call graph for this function:

Field Documentation

◆ $authtype

soap_transport_http::$authtype = ''

Definition at line 2157 of file nusoap.php.

◆ $certRequest

soap_transport_http::$certRequest = array()

Definition at line 2159 of file nusoap.php.

◆ $ch

soap_transport_http::$ch = false

Definition at line 1569 of file nusoap.php.

◆ $ch_options

soap_transport_http::$ch_options = array()

Definition at line 2152 of file nusoap.php.

◆ $digest_uri

soap_transport_http::$digest_uri = ''

Definition at line 2135 of file nusoap.php.

◆ $digestRequest

soap_transport_http::$digestRequest = array()

Definition at line 2158 of file nusoap.php.

◆ $encoding

soap_transport_http::$encoding = ''

Definition at line 1562 of file nusoap.php.

◆ $host

soap_transport_http::$host = ''

Definition at line 1557 of file nusoap.php.

◆ $incoming_cookies

soap_transport_http::$incoming_cookies = array()

Definition at line 2145 of file nusoap.php.

◆ $incoming_headers

soap_transport_http::$incoming_headers = array()

Definition at line 1564 of file nusoap.php.

◆ $incoming_payload

soap_transport_http::$incoming_payload = ''

Definition at line 1566 of file nusoap.php.

◆ $outgoing_headers

soap_transport_http::$outgoing_headers = array()

Definition at line 1563 of file nusoap.php.

◆ $outgoing_payload

soap_transport_http::$outgoing_payload = ''

Definition at line 1565 of file nusoap.php.

◆ $password

soap_transport_http::$password = ''

Definition at line 1571 of file nusoap.php.

◆ $path

soap_transport_http::$path = ''

Definition at line 1559 of file nusoap.php.

◆ $persistentConnection

soap_transport_http::$persistentConnection = false

Definition at line 1568 of file nusoap.php.

◆ $port

soap_transport_http::$port = ''

Definition at line 1558 of file nusoap.php.

◆ $protocol_version

soap_transport_http::$protocol_version = '1.0'

Definition at line 1561 of file nusoap.php.

◆ $proxy

soap_transport_http::$proxy = null

Definition at line 2154 of file nusoap.php.

◆ $request_method

soap_transport_http::$request_method = 'POST'

Definition at line 1560 of file nusoap.php.

◆ $response_status_line

soap_transport_http::$response_status_line

Definition at line 2148 of file nusoap.php.

◆ $scheme

soap_transport_http::$scheme = ''

Definition at line 1556 of file nusoap.php.

◆ $uri

soap_transport_http::$uri = ''

Definition at line 1555 of file nusoap.php.

◆ $url

soap_transport_http::$url = ''

Definition at line 1554 of file nusoap.php.

◆ $use_curl

soap_transport_http::$use_curl = false

Definition at line 2153 of file nusoap.php.

◆ $username

soap_transport_http::$username = ''

Definition at line 1570 of file nusoap.php.

◆ $useSOAPAction

soap_transport_http::$useSOAPAction = true

Definition at line 1567 of file nusoap.php.


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