Öffentliche Methoden | |
soap_transport_http ($url, $curl_options=NULL, $use_curl=false) | |
setCurlOption ($option, $value) | |
setHeader ($name, $value) | |
unsetHeader ($name) | |
setURL ($url) | |
io_method () | |
connect ($connection_timeout=0, $response_timeout=30) | |
send ($data, $timeout=0, $response_timeout=30, $cookies=NULL) | |
sendHTTPS ($data, $timeout=0, $response_timeout=30, $cookies) | |
setCredentials ($username, $password, $authtype= 'basic', $digestRequest=array(), $certRequest=array()) | |
setSOAPAction ($soapaction) | |
setEncoding ($enc='gzip, deflate') | |
setProxy ($proxyhost, $proxyport, $proxyusername= '', $proxypassword= '', $proxyauthtype= 'basic') | |
isSkippableCurlHeader (&$data) | |
decodeChunked ($buffer, $lb) | |
buildPayload ($data, $cookie_str= '') | |
sendRequest ($data, $cookies=NULL) | |
getResponse () | |
setContentType ($type, $charset=false) | |
usePersistentConnection () | |
parseCookie ($cookie_str) | |
getCookiesForRequest ($cookies, $secure=false) | |
soap_transport_http ($url, $curl_options=NULL, $use_curl=false) | |
setCurlOption ($option, $value) | |
setHeader ($name, $value) | |
unsetHeader ($name) | |
setURL ($url) | |
io_method () | |
connect ($connection_timeout=0, $response_timeout=30) | |
send ($data, $timeout=0, $response_timeout=30, $cookies=NULL) | |
sendHTTPS ($data, $timeout=0, $response_timeout=30, $cookies) | |
setCredentials ($username, $password, $authtype= 'basic', $digestRequest=array(), $certRequest=array()) | |
setSOAPAction ($soapaction) | |
setEncoding ($enc='gzip, deflate') | |
setProxy ($proxyhost, $proxyport, $proxyusername= '', $proxypassword= '', $proxyauthtype= 'basic') | |
isSkippableCurlHeader (&$data) | |
decodeChunked ($buffer, $lb) | |
buildPayload ($data, $cookie_str= '') | |
sendRequest ($data, $cookies=NULL) | |
getResponse () | |
setContentType ($type, $charset=false) | |
usePersistentConnection () | |
parseCookie ($cookie_str) | |
getCookiesForRequest ($cookies, $secure=false) | |
Öffentliche Attribute | |
$url = '' | |
$uri = '' | |
$digest_uri = '' | |
$scheme = '' | |
$host = '' | |
$port = '' | |
$path = '' | |
$request_method = 'POST' | |
$protocol_version = '1.0' | |
$encoding = '' | |
$outgoing_headers = array() | |
$incoming_headers = array() | |
$incoming_cookies = array() | |
$outgoing_payload = '' | |
$incoming_payload = '' | |
$response_status_line | |
$useSOAPAction = true | |
$persistentConnection = false | |
$ch = false | |
$ch_options = array() | |
$use_curl = false | |
$proxy = null | |
$username = '' | |
$password = '' | |
$authtype = '' | |
$digestRequest = array() | |
$certRequest = array() |
transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support
Definiert in Zeile 15 der Datei class.soap_transport_http.php.
soap_transport_http::buildPayload | ( | $ | data, | |
$ | cookie_str = '' | |||
) |
Writes the payload, including HTTP headers, to $this->outgoing_payload.
string | $data HTTP body | |
string | $cookie_str data for HTTP Cookie header |
Definiert in Zeile 2831 der Datei nusoap.php.
02831 { 02832 // Note: for cURL connections, $this->outgoing_payload is ignored, 02833 // as is the Content-Length header, but these are still created as 02834 // debugging guides. 02835 02836 // add content-length header 02837 if ($this->request_method != 'GET') { 02838 $this->setHeader('Content-Length', strlen($data)); 02839 } 02840 02841 // start building outgoing payload: 02842 if ($this->proxy) { 02843 $uri = $this->url; 02844 } else { 02845 $uri = $this->uri; 02846 } 02847 $req = "$this->request_method $uri HTTP/$this->protocol_version"; 02848 $this->debug("HTTP request: $req"); 02849 $this->outgoing_payload = "$req\r\n"; 02850 02851 // loop thru headers, serializing 02852 foreach($this->outgoing_headers as $k => $v){ 02853 $hdr = $k.': '.$v; 02854 $this->debug("HTTP header: $hdr"); 02855 $this->outgoing_payload .= "$hdr\r\n"; 02856 } 02857 02858 // add any cookies 02859 if ($cookie_str != '') { 02860 $hdr = 'Cookie: '.$cookie_str; 02861 $this->debug("HTTP header: $hdr"); 02862 $this->outgoing_payload .= "$hdr\r\n"; 02863 } 02864 02865 // header/body separator 02866 $this->outgoing_payload .= "\r\n"; 02867 02868 // add data 02869 $this->outgoing_payload .= $data; 02870 }
soap_transport_http::buildPayload | ( | $ | data, | |
$ | cookie_str = '' | |||
) |
Writes the payload, including HTTP headers, to $this->outgoing_payload.
string | $data HTTP body | |
string | $cookie_str data for HTTP Cookie header |
Definiert in Zeile 688 der Datei class.soap_transport_http.php.
00688 { 00689 // Note: for cURL connections, $this->outgoing_payload is ignored, 00690 // as is the Content-Length header, but these are still created as 00691 // debugging guides. 00692 00693 // add content-length header 00694 if ($this->request_method != 'GET') { 00695 $this->setHeader('Content-Length', strlen($data)); 00696 } 00697 00698 // start building outgoing payload: 00699 if ($this->proxy) { 00700 $uri = $this->url; 00701 } else { 00702 $uri = $this->uri; 00703 } 00704 $req = "$this->request_method $uri HTTP/$this->protocol_version"; 00705 $this->debug("HTTP request: $req"); 00706 $this->outgoing_payload = "$req\r\n"; 00707 00708 // loop thru headers, serializing 00709 foreach($this->outgoing_headers as $k => $v){ 00710 $hdr = $k.': '.$v; 00711 $this->debug("HTTP header: $hdr"); 00712 $this->outgoing_payload .= "$hdr\r\n"; 00713 } 00714 00715 // add any cookies 00716 if ($cookie_str != '') { 00717 $hdr = 'Cookie: '.$cookie_str; 00718 $this->debug("HTTP header: $hdr"); 00719 $this->outgoing_payload .= "$hdr\r\n"; 00720 } 00721 00722 // header/body separator 00723 $this->outgoing_payload .= "\r\n"; 00724 00725 // add data 00726 $this->outgoing_payload .= $data; 00727 }
soap_transport_http::connect | ( | $ | connection_timeout = 0 , |
|
$ | response_timeout = 30 | |||
) |
establish an HTTP connection
integer | $timeout set connection timeout in seconds | |
integer | $response_timeout set response timeout in seconds |
Definiert in Zeile 2320 der Datei nusoap.php.
02320 { 02321 // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like 02322 // "regular" socket. 02323 // TODO: disabled for now because OpenSSL must be *compiled* in (not just 02324 // loaded), and until PHP5 stream_get_wrappers is not available. 02325 // if ($this->scheme == 'https') { 02326 // if (version_compare(phpversion(), '4.3.0') >= 0) { 02327 // if (extension_loaded('openssl')) { 02328 // $this->scheme = 'ssl'; 02329 // $this->debug('Using SSL over OpenSSL'); 02330 // } 02331 // } 02332 // } 02333 $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); 02334 if ($this->io_method() == 'socket') { 02335 if (!is_array($this->proxy)) { 02336 $host = $this->host; 02337 $port = $this->port; 02338 } else { 02339 $host = $this->proxy['host']; 02340 $port = $this->proxy['port']; 02341 } 02342 02343 // use persistent connection 02344 if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ 02345 if (!feof($this->fp)) { 02346 $this->debug('Re-use persistent connection'); 02347 return true; 02348 } 02349 fclose($this->fp); 02350 $this->debug('Closed persistent connection at EOF'); 02351 } 02352 02353 // munge host if using OpenSSL 02354 if ($this->scheme == 'ssl') { 02355 $host = 'ssl://' . $host; 02356 } 02357 $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); 02358 02359 // open socket 02360 if($connection_timeout > 0){ 02361 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); 02362 } else { 02363 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); 02364 } 02365 02366 // test pointer 02367 if(!$this->fp) { 02368 $msg = 'Couldn\'t open socket connection to server ' . $this->url; 02369 if ($this->errno) { 02370 $msg .= ', Error ('.$this->errno.'): '.$this->error_str; 02371 } else { 02372 $msg .= ' prior to connect(). This is often a problem looking up the host name.'; 02373 } 02374 $this->debug($msg); 02375 $this->setError($msg); 02376 return false; 02377 } 02378 02379 // set response timeout 02380 $this->debug('set response timeout to ' . $response_timeout); 02381 socket_set_timeout( $this->fp, $response_timeout); 02382 02383 $this->debug('socket connected'); 02384 return true; 02385 } else if ($this->io_method() == 'curl') { 02386 if (!extension_loaded('curl')) { 02387 // $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); 02388 $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.'); 02389 return false; 02390 } 02391 // Avoid warnings when PHP does not have these options 02392 if (defined('CURLOPT_CONNECTIONTIMEOUT')) 02393 $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; 02394 else 02395 $CURLOPT_CONNECTIONTIMEOUT = 78; 02396 if (defined('CURLOPT_HTTPAUTH')) 02397 $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; 02398 else 02399 $CURLOPT_HTTPAUTH = 107; 02400 if (defined('CURLOPT_PROXYAUTH')) 02401 $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; 02402 else 02403 $CURLOPT_PROXYAUTH = 111; 02404 if (defined('CURLAUTH_BASIC')) 02405 $CURLAUTH_BASIC = CURLAUTH_BASIC; 02406 else 02407 $CURLAUTH_BASIC = 1; 02408 if (defined('CURLAUTH_DIGEST')) 02409 $CURLAUTH_DIGEST = CURLAUTH_DIGEST; 02410 else 02411 $CURLAUTH_DIGEST = 2; 02412 if (defined('CURLAUTH_NTLM')) 02413 $CURLAUTH_NTLM = CURLAUTH_NTLM; 02414 else 02415 $CURLAUTH_NTLM = 8; 02416 02417 $this->debug('connect using cURL'); 02418 // init CURL 02419 $this->ch = curl_init(); 02420 // set url 02421 $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; 02422 // add path 02423 $hostURL .= $this->path; 02424 $this->setCurlOption(CURLOPT_URL, $hostURL); 02425 // follow location headers (re-directs) 02426 if (ini_get('safe_mode') || ini_get('open_basedir')) { 02427 $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); 02428 $this->debug('safe_mode = '); 02429 $this->appendDebug($this->varDump(ini_get('safe_mode'))); 02430 $this->debug('open_basedir = '); 02431 $this->appendDebug($this->varDump(ini_get('open_basedir'))); 02432 } else { 02433 $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); 02434 } 02435 // ask for headers in the response output 02436 $this->setCurlOption(CURLOPT_HEADER, 1); 02437 // ask for the response output as the return value 02438 $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); 02439 // encode 02440 // We manage this ourselves through headers and encoding 02441 // if(function_exists('gzuncompress')){ 02442 // $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); 02443 // } 02444 // persistent connection 02445 if ($this->persistentConnection) { 02446 // I believe the following comment is now bogus, having applied to 02447 // the code when it used CURLOPT_CUSTOMREQUEST to send the request. 02448 // The way we send data, we cannot use persistent connections, since 02449 // there will be some "junk" at the end of our request. 02450 //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); 02451 $this->persistentConnection = false; 02452 $this->setHeader('Connection', 'close'); 02453 } 02454 // set timeouts 02455 if ($connection_timeout != 0) { 02456 $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); 02457 } 02458 if ($response_timeout != 0) { 02459 $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); 02460 } 02461 02462 if ($this->scheme == 'https') { 02463 $this->debug('set cURL SSL verify options'); 02464 // recent versions of cURL turn on peer/host checking by default, 02465 // while PHP binaries are not compiled with a default location for the 02466 // CA cert bundle, so disable peer/host checking. 02467 //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); 02468 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); 02469 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); 02470 02471 // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) 02472 if ($this->authtype == 'certificate') { 02473 $this->debug('set cURL certificate options'); 02474 if (isset($this->certRequest['cainfofile'])) { 02475 $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); 02476 } 02477 if (isset($this->certRequest['verifypeer'])) { 02478 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); 02479 } else { 02480 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); 02481 } 02482 if (isset($this->certRequest['verifyhost'])) { 02483 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); 02484 } else { 02485 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); 02486 } 02487 if (isset($this->certRequest['sslcertfile'])) { 02488 $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); 02489 } 02490 if (isset($this->certRequest['sslkeyfile'])) { 02491 $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); 02492 } 02493 if (isset($this->certRequest['passphrase'])) { 02494 $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); 02495 } 02496 if (isset($this->certRequest['certpassword'])) { 02497 $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); 02498 } 02499 } 02500 } 02501 if ($this->authtype && ($this->authtype != 'certificate')) { 02502 if ($this->username) { 02503 $this->debug('set cURL username/password'); 02504 $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); 02505 } 02506 if ($this->authtype == 'basic') { 02507 $this->debug('set cURL for Basic authentication'); 02508 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); 02509 } 02510 if ($this->authtype == 'digest') { 02511 $this->debug('set cURL for digest authentication'); 02512 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); 02513 } 02514 if ($this->authtype == 'ntlm') { 02515 $this->debug('set cURL for NTLM authentication'); 02516 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); 02517 } 02518 } 02519 if (is_array($this->proxy)) { 02520 $this->debug('set cURL proxy options'); 02521 if ($this->proxy['port'] != '') { 02522 $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); 02523 } else { 02524 $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); 02525 } 02526 if ($this->proxy['username'] || $this->proxy['password']) { 02527 $this->debug('set cURL proxy authentication options'); 02528 $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); 02529 if ($this->proxy['authtype'] == 'basic') { 02530 $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); 02531 } 02532 if ($this->proxy['authtype'] == 'ntlm') { 02533 $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); 02534 } 02535 } 02536 } 02537 $this->debug('cURL connection set up'); 02538 return true; 02539 } else { 02540 $this->setError('Unknown scheme ' . $this->scheme); 02541 $this->debug('Unknown scheme ' . $this->scheme); 02542 return false; 02543 } 02544 }
soap_transport_http::connect | ( | $ | connection_timeout = 0 , |
|
$ | response_timeout = 30 | |||
) |
establish an HTTP connection
integer | $timeout set connection timeout in seconds | |
integer | $response_timeout set response timeout in seconds |
Definiert in Zeile 177 der Datei class.soap_transport_http.php.
00177 { 00178 // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like 00179 // "regular" socket. 00180 // TODO: disabled for now because OpenSSL must be *compiled* in (not just 00181 // loaded), and until PHP5 stream_get_wrappers is not available. 00182 // if ($this->scheme == 'https') { 00183 // if (version_compare(phpversion(), '4.3.0') >= 0) { 00184 // if (extension_loaded('openssl')) { 00185 // $this->scheme = 'ssl'; 00186 // $this->debug('Using SSL over OpenSSL'); 00187 // } 00188 // } 00189 // } 00190 $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); 00191 if ($this->io_method() == 'socket') { 00192 if (!is_array($this->proxy)) { 00193 $host = $this->host; 00194 $port = $this->port; 00195 } else { 00196 $host = $this->proxy['host']; 00197 $port = $this->proxy['port']; 00198 } 00199 00200 // use persistent connection 00201 if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ 00202 if (!feof($this->fp)) { 00203 $this->debug('Re-use persistent connection'); 00204 return true; 00205 } 00206 fclose($this->fp); 00207 $this->debug('Closed persistent connection at EOF'); 00208 } 00209 00210 // munge host if using OpenSSL 00211 if ($this->scheme == 'ssl') { 00212 $host = 'ssl://' . $host; 00213 } 00214 $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); 00215 00216 // open socket 00217 if($connection_timeout > 0){ 00218 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); 00219 } else { 00220 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); 00221 } 00222 00223 // test pointer 00224 if(!$this->fp) { 00225 $msg = 'Couldn\'t open socket connection to server ' . $this->url; 00226 if ($this->errno) { 00227 $msg .= ', Error ('.$this->errno.'): '.$this->error_str; 00228 } else { 00229 $msg .= ' prior to connect(). This is often a problem looking up the host name.'; 00230 } 00231 $this->debug($msg); 00232 $this->setError($msg); 00233 return false; 00234 } 00235 00236 // set response timeout 00237 $this->debug('set response timeout to ' . $response_timeout); 00238 socket_set_timeout( $this->fp, $response_timeout); 00239 00240 $this->debug('socket connected'); 00241 return true; 00242 } else if ($this->io_method() == 'curl') { 00243 if (!extension_loaded('curl')) { 00244 // $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); 00245 $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.'); 00246 return false; 00247 } 00248 // Avoid warnings when PHP does not have these options 00249 if (defined('CURLOPT_CONNECTIONTIMEOUT')) 00250 $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; 00251 else 00252 $CURLOPT_CONNECTIONTIMEOUT = 78; 00253 if (defined('CURLOPT_HTTPAUTH')) 00254 $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; 00255 else 00256 $CURLOPT_HTTPAUTH = 107; 00257 if (defined('CURLOPT_PROXYAUTH')) 00258 $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; 00259 else 00260 $CURLOPT_PROXYAUTH = 111; 00261 if (defined('CURLAUTH_BASIC')) 00262 $CURLAUTH_BASIC = CURLAUTH_BASIC; 00263 else 00264 $CURLAUTH_BASIC = 1; 00265 if (defined('CURLAUTH_DIGEST')) 00266 $CURLAUTH_DIGEST = CURLAUTH_DIGEST; 00267 else 00268 $CURLAUTH_DIGEST = 2; 00269 if (defined('CURLAUTH_NTLM')) 00270 $CURLAUTH_NTLM = CURLAUTH_NTLM; 00271 else 00272 $CURLAUTH_NTLM = 8; 00273 00274 $this->debug('connect using cURL'); 00275 // init CURL 00276 $this->ch = curl_init(); 00277 // set url 00278 $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; 00279 // add path 00280 $hostURL .= $this->path; 00281 $this->setCurlOption(CURLOPT_URL, $hostURL); 00282 // follow location headers (re-directs) 00283 if (ini_get('safe_mode') || ini_get('open_basedir')) { 00284 $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); 00285 $this->debug('safe_mode = '); 00286 $this->appendDebug($this->varDump(ini_get('safe_mode'))); 00287 $this->debug('open_basedir = '); 00288 $this->appendDebug($this->varDump(ini_get('open_basedir'))); 00289 } else { 00290 $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); 00291 } 00292 // ask for headers in the response output 00293 $this->setCurlOption(CURLOPT_HEADER, 1); 00294 // ask for the response output as the return value 00295 $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); 00296 // encode 00297 // We manage this ourselves through headers and encoding 00298 // if(function_exists('gzuncompress')){ 00299 // $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); 00300 // } 00301 // persistent connection 00302 if ($this->persistentConnection) { 00303 // I believe the following comment is now bogus, having applied to 00304 // the code when it used CURLOPT_CUSTOMREQUEST to send the request. 00305 // The way we send data, we cannot use persistent connections, since 00306 // there will be some "junk" at the end of our request. 00307 //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); 00308 $this->persistentConnection = false; 00309 $this->setHeader('Connection', 'close'); 00310 } 00311 // set timeouts 00312 if ($connection_timeout != 0) { 00313 $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); 00314 } 00315 if ($response_timeout != 0) { 00316 $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); 00317 } 00318 00319 if ($this->scheme == 'https') { 00320 $this->debug('set cURL SSL verify options'); 00321 // recent versions of cURL turn on peer/host checking by default, 00322 // while PHP binaries are not compiled with a default location for the 00323 // CA cert bundle, so disable peer/host checking. 00324 //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); 00325 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); 00326 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); 00327 00328 // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) 00329 if ($this->authtype == 'certificate') { 00330 $this->debug('set cURL certificate options'); 00331 if (isset($this->certRequest['cainfofile'])) { 00332 $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); 00333 } 00334 if (isset($this->certRequest['verifypeer'])) { 00335 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); 00336 } else { 00337 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); 00338 } 00339 if (isset($this->certRequest['verifyhost'])) { 00340 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); 00341 } else { 00342 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); 00343 } 00344 if (isset($this->certRequest['sslcertfile'])) { 00345 $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); 00346 } 00347 if (isset($this->certRequest['sslkeyfile'])) { 00348 $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); 00349 } 00350 if (isset($this->certRequest['passphrase'])) { 00351 $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); 00352 } 00353 if (isset($this->certRequest['certpassword'])) { 00354 $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); 00355 } 00356 } 00357 } 00358 if ($this->authtype && ($this->authtype != 'certificate')) { 00359 if ($this->username) { 00360 $this->debug('set cURL username/password'); 00361 $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); 00362 } 00363 if ($this->authtype == 'basic') { 00364 $this->debug('set cURL for Basic authentication'); 00365 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); 00366 } 00367 if ($this->authtype == 'digest') { 00368 $this->debug('set cURL for digest authentication'); 00369 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); 00370 } 00371 if ($this->authtype == 'ntlm') { 00372 $this->debug('set cURL for NTLM authentication'); 00373 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); 00374 } 00375 } 00376 if (is_array($this->proxy)) { 00377 $this->debug('set cURL proxy options'); 00378 if ($this->proxy['port'] != '') { 00379 $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); 00380 } else { 00381 $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); 00382 } 00383 if ($this->proxy['username'] || $this->proxy['password']) { 00384 $this->debug('set cURL proxy authentication options'); 00385 $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); 00386 if ($this->proxy['authtype'] == 'basic') { 00387 $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); 00388 } 00389 if ($this->proxy['authtype'] == 'ntlm') { 00390 $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); 00391 } 00392 } 00393 } 00394 $this->debug('cURL connection set up'); 00395 return true; 00396 } else { 00397 $this->setError('Unknown scheme ' . $this->scheme); 00398 $this->debug('Unknown scheme ' . $this->scheme); 00399 return false; 00400 } 00401 }
soap_transport_http::decodeChunked | ( | $ | buffer, | |
$ | lb | |||
) |
decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6
string | $buffer | |
string | $lb |
Definiert in Zeile 2774 der Datei nusoap.php.
02774 { 02775 // length := 0 02776 $length = 0; 02777 $new = ''; 02778 02779 // read chunk-size, chunk-extension (if any) and CRLF 02780 // get the position of the linebreak 02781 $chunkend = strpos($buffer, $lb); 02782 if ($chunkend == FALSE) { 02783 $this->debug('no linebreak found in decodeChunked'); 02784 return $new; 02785 } 02786 $temp = substr($buffer,0,$chunkend); 02787 $chunk_size = hexdec( trim($temp) ); 02788 $chunkstart = $chunkend + strlen($lb); 02789 // while (chunk-size > 0) { 02790 while ($chunk_size > 0) { 02791 $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); 02792 $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); 02793 02794 // Just in case we got a broken connection 02795 if ($chunkend == FALSE) { 02796 $chunk = substr($buffer,$chunkstart); 02797 // append chunk-data to entity-body 02798 $new .= $chunk; 02799 $length += strlen($chunk); 02800 break; 02801 } 02802 02803 // read chunk-data and CRLF 02804 $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); 02805 // append chunk-data to entity-body 02806 $new .= $chunk; 02807 // length := length + chunk-size 02808 $length += strlen($chunk); 02809 // read chunk-size and CRLF 02810 $chunkstart = $chunkend + strlen($lb); 02811 02812 $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); 02813 if ($chunkend == FALSE) { 02814 break; //Just in case we got a broken connection 02815 } 02816 $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); 02817 $chunk_size = hexdec( trim($temp) ); 02818 $chunkstart = $chunkend; 02819 } 02820 return $new; 02821 }
soap_transport_http::decodeChunked | ( | $ | buffer, | |
$ | lb | |||
) |
decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6
string | $buffer | |
string | $lb |
Definiert in Zeile 631 der Datei class.soap_transport_http.php.
00631 { 00632 // length := 0 00633 $length = 0; 00634 $new = ''; 00635 00636 // read chunk-size, chunk-extension (if any) and CRLF 00637 // get the position of the linebreak 00638 $chunkend = strpos($buffer, $lb); 00639 if ($chunkend == FALSE) { 00640 $this->debug('no linebreak found in decodeChunked'); 00641 return $new; 00642 } 00643 $temp = substr($buffer,0,$chunkend); 00644 $chunk_size = hexdec( trim($temp) ); 00645 $chunkstart = $chunkend + strlen($lb); 00646 // while (chunk-size > 0) { 00647 while ($chunk_size > 0) { 00648 $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); 00649 $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); 00650 00651 // Just in case we got a broken connection 00652 if ($chunkend == FALSE) { 00653 $chunk = substr($buffer,$chunkstart); 00654 // append chunk-data to entity-body 00655 $new .= $chunk; 00656 $length += strlen($chunk); 00657 break; 00658 } 00659 00660 // read chunk-data and CRLF 00661 $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); 00662 // append chunk-data to entity-body 00663 $new .= $chunk; 00664 // length := length + chunk-size 00665 $length += strlen($chunk); 00666 // read chunk-size and CRLF 00667 $chunkstart = $chunkend + strlen($lb); 00668 00669 $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); 00670 if ($chunkend == FALSE) { 00671 break; //Just in case we got a broken connection 00672 } 00673 $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); 00674 $chunk_size = hexdec( trim($temp) ); 00675 $chunkstart = $chunkend; 00676 } 00677 return $new; 00678 }
soap_transport_http::getCookiesForRequest | ( | $ | cookies, | |
$ | secure = false | |||
) |
sort out cookies for the current request
array | $cookies array with all cookies | |
boolean | $secure is the send-content secure or not? |
Definiert in Zeile 3409 der Datei nusoap.php.
03409 { 03410 $cookie_str = ''; 03411 if ((! is_null($cookies)) && (is_array($cookies))) { 03412 foreach ($cookies as $cookie) { 03413 if (! is_array($cookie)) { 03414 continue; 03415 } 03416 $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); 03417 if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { 03418 if (strtotime($cookie['expires']) <= time()) { 03419 $this->debug('cookie has expired'); 03420 continue; 03421 } 03422 } 03423 if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { 03424 $domain = preg_quote($cookie['domain']); 03425 if (! preg_match("'.*$domain$'i", $this->host)) { 03426 $this->debug('cookie has different domain'); 03427 continue; 03428 } 03429 } 03430 if ((isset($cookie['path'])) && (! empty($cookie['path']))) { 03431 $path = preg_quote($cookie['path']); 03432 if (! preg_match("'^$path.*'i", $this->path)) { 03433 $this->debug('cookie is for a different path'); 03434 continue; 03435 } 03436 } 03437 if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { 03438 $this->debug('cookie is secure, transport is not'); 03439 continue; 03440 } 03441 $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; 03442 $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); 03443 } 03444 } 03445 return $cookie_str; 03446 }
soap_transport_http::getCookiesForRequest | ( | $ | cookies, | |
$ | secure = false | |||
) |
sort out cookies for the current request
array | $cookies array with all cookies | |
boolean | $secure is the send-content secure or not? |
Definiert in Zeile 1266 der Datei class.soap_transport_http.php.
01266 { 01267 $cookie_str = ''; 01268 if ((! is_null($cookies)) && (is_array($cookies))) { 01269 foreach ($cookies as $cookie) { 01270 if (! is_array($cookie)) { 01271 continue; 01272 } 01273 $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); 01274 if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { 01275 if (strtotime($cookie['expires']) <= time()) { 01276 $this->debug('cookie has expired'); 01277 continue; 01278 } 01279 } 01280 if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { 01281 $domain = preg_quote($cookie['domain']); 01282 if (! preg_match("'.*$domain$'i", $this->host)) { 01283 $this->debug('cookie has different domain'); 01284 continue; 01285 } 01286 } 01287 if ((isset($cookie['path'])) && (! empty($cookie['path']))) { 01288 $path = preg_quote($cookie['path']); 01289 if (! preg_match("'^$path.*'i", $this->path)) { 01290 $this->debug('cookie is for a different path'); 01291 continue; 01292 } 01293 } 01294 if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { 01295 $this->debug('cookie is secure, transport is not'); 01296 continue; 01297 } 01298 $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; 01299 $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); 01300 } 01301 } 01302 return $cookie_str; 01303 }
soap_transport_http::getResponse | ( | ) |
gets the SOAP response via HTTP[S]
Definiert in Zeile 2937 der Datei nusoap.php.
02937 { 02938 $this->incoming_payload = ''; 02939 02940 if ($this->io_method() == 'socket') { 02941 // loop until headers have been retrieved 02942 $data = ''; 02943 while (!isset($lb)){ 02944 02945 // We might EOF during header read. 02946 if(feof($this->fp)) { 02947 $this->incoming_payload = $data; 02948 $this->debug('found no headers before EOF after length ' . strlen($data)); 02949 $this->debug("received before EOF:\n" . $data); 02950 $this->setError('server failed to send headers'); 02951 return false; 02952 } 02953 02954 $tmp = fgets($this->fp, 256); 02955 $tmplen = strlen($tmp); 02956 $this->debug("read line of $tmplen bytes: " . trim($tmp)); 02957 02958 if ($tmplen == 0) { 02959 $this->incoming_payload = $data; 02960 $this->debug('socket read of headers timed out after length ' . strlen($data)); 02961 $this->debug("read before timeout: " . $data); 02962 $this->setError('socket read of headers timed out'); 02963 return false; 02964 } 02965 02966 $data .= $tmp; 02967 $pos = strpos($data,"\r\n\r\n"); 02968 if($pos > 1){ 02969 $lb = "\r\n"; 02970 } else { 02971 $pos = strpos($data,"\n\n"); 02972 if($pos > 1){ 02973 $lb = "\n"; 02974 } 02975 } 02976 // remove 100 headers 02977 if (isset($lb) && ereg('^HTTP/1.1 100',$data)) { 02978 unset($lb); 02979 $data = ''; 02980 }// 02981 } 02982 // store header data 02983 $this->incoming_payload .= $data; 02984 $this->debug('found end of headers after length ' . strlen($data)); 02985 // process headers 02986 $header_data = trim(substr($data,0,$pos)); 02987 $header_array = explode($lb,$header_data); 02988 $this->incoming_headers = array(); 02989 $this->incoming_cookies = array(); 02990 foreach($header_array as $header_line){ 02991 $arr = explode(':',$header_line, 2); 02992 if(count($arr) > 1){ 02993 $header_name = strtolower(trim($arr[0])); 02994 $this->incoming_headers[$header_name] = trim($arr[1]); 02995 if ($header_name == 'set-cookie') { 02996 // TODO: allow multiple cookies from parseCookie 02997 $cookie = $this->parseCookie(trim($arr[1])); 02998 if ($cookie) { 02999 $this->incoming_cookies[] = $cookie; 03000 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); 03001 } else { 03002 $this->debug('did not find cookie in ' . trim($arr[1])); 03003 } 03004 } 03005 } else if (isset($header_name)) { 03006 // append continuation line to previous header 03007 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; 03008 } 03009 } 03010 03011 // loop until msg has been received 03012 if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { 03013 $content_length = 2147483647; // ignore any content-length header 03014 $chunked = true; 03015 $this->debug("want to read chunked content"); 03016 } elseif (isset($this->incoming_headers['content-length'])) { 03017 $content_length = $this->incoming_headers['content-length']; 03018 $chunked = false; 03019 $this->debug("want to read content of length $content_length"); 03020 } else { 03021 $content_length = 2147483647; 03022 $chunked = false; 03023 $this->debug("want to read content to EOF"); 03024 } 03025 $data = ''; 03026 do { 03027 if ($chunked) { 03028 $tmp = fgets($this->fp, 256); 03029 $tmplen = strlen($tmp); 03030 $this->debug("read chunk line of $tmplen bytes"); 03031 if ($tmplen == 0) { 03032 $this->incoming_payload = $data; 03033 $this->debug('socket read of chunk length timed out after length ' . strlen($data)); 03034 $this->debug("read before timeout:\n" . $data); 03035 $this->setError('socket read of chunk length timed out'); 03036 return false; 03037 } 03038 $content_length = hexdec(trim($tmp)); 03039 $this->debug("chunk length $content_length"); 03040 } 03041 $strlen = 0; 03042 while (($strlen < $content_length) && (!feof($this->fp))) { 03043 $readlen = min(8192, $content_length - $strlen); 03044 $tmp = fread($this->fp, $readlen); 03045 $tmplen = strlen($tmp); 03046 $this->debug("read buffer of $tmplen bytes"); 03047 if (($tmplen == 0) && (!feof($this->fp))) { 03048 $this->incoming_payload = $data; 03049 $this->debug('socket read of body timed out after length ' . strlen($data)); 03050 $this->debug("read before timeout:\n" . $data); 03051 $this->setError('socket read of body timed out'); 03052 return false; 03053 } 03054 $strlen += $tmplen; 03055 $data .= $tmp; 03056 } 03057 if ($chunked && ($content_length > 0)) { 03058 $tmp = fgets($this->fp, 256); 03059 $tmplen = strlen($tmp); 03060 $this->debug("read chunk terminator of $tmplen bytes"); 03061 if ($tmplen == 0) { 03062 $this->incoming_payload = $data; 03063 $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); 03064 $this->debug("read before timeout:\n" . $data); 03065 $this->setError('socket read of chunk terminator timed out'); 03066 return false; 03067 } 03068 } 03069 } while ($chunked && ($content_length > 0) && (!feof($this->fp))); 03070 if (feof($this->fp)) { 03071 $this->debug('read to EOF'); 03072 } 03073 $this->debug('read body of length ' . strlen($data)); 03074 $this->incoming_payload .= $data; 03075 $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); 03076 03077 // close filepointer 03078 if( 03079 (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 03080 (! $this->persistentConnection) || feof($this->fp)){ 03081 fclose($this->fp); 03082 $this->fp = false; 03083 $this->debug('closed socket'); 03084 } 03085 03086 // connection was closed unexpectedly 03087 if($this->incoming_payload == ''){ 03088 $this->setError('no response from server'); 03089 return false; 03090 } 03091 03092 // decode transfer-encoding 03093 // if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ 03094 // if(!$data = $this->decodeChunked($data, $lb)){ 03095 // $this->setError('Decoding of chunked data failed'); 03096 // return false; 03097 // } 03098 //print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>"; 03099 // set decoded payload 03100 // $this->incoming_payload = $header_data.$lb.$lb.$data; 03101 // } 03102 03103 } else if ($this->io_method() == 'curl') { 03104 // send and receive 03105 $this->debug('send and receive with cURL'); 03106 $this->incoming_payload = curl_exec($this->ch); 03107 $data = $this->incoming_payload; 03108 03109 $cErr = curl_error($this->ch); 03110 if ($cErr != '') { 03111 $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>'; 03112 // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE 03113 foreach(curl_getinfo($this->ch) as $k => $v){ 03114 $err .= "$k: $v<br>"; 03115 } 03116 $this->debug($err); 03117 $this->setError($err); 03118 curl_close($this->ch); 03119 return false; 03120 } else { 03121 //echo '<pre>'; 03122 //var_dump(curl_getinfo($this->ch)); 03123 //echo '</pre>'; 03124 } 03125 // close curl 03126 $this->debug('No cURL error, closing cURL'); 03127 curl_close($this->ch); 03128 03129 // try removing skippable headers 03130 $savedata = $data; 03131 while ($this->isSkippableCurlHeader($data)) { 03132 $this->debug("Found HTTP header to skip"); 03133 if ($pos = strpos($data,"\r\n\r\n")) { 03134 $data = ltrim(substr($data,$pos)); 03135 } elseif($pos = strpos($data,"\n\n") ) { 03136 $data = ltrim(substr($data,$pos)); 03137 } 03138 } 03139 03140 if ($data == '') { 03141 // have nothing left; just remove 100 header(s) 03142 $data = $savedata; 03143 while (ereg('^HTTP/1.1 100',$data)) { 03144 if ($pos = strpos($data,"\r\n\r\n")) { 03145 $data = ltrim(substr($data,$pos)); 03146 } elseif($pos = strpos($data,"\n\n") ) { 03147 $data = ltrim(substr($data,$pos)); 03148 } 03149 } 03150 } 03151 03152 // separate content from HTTP headers 03153 if ($pos = strpos($data,"\r\n\r\n")) { 03154 $lb = "\r\n"; 03155 } elseif( $pos = strpos($data,"\n\n")) { 03156 $lb = "\n"; 03157 } else { 03158 $this->debug('no proper separation of headers and document'); 03159 $this->setError('no proper separation of headers and document'); 03160 return false; 03161 } 03162 $header_data = trim(substr($data,0,$pos)); 03163 $header_array = explode($lb,$header_data); 03164 $data = ltrim(substr($data,$pos)); 03165 $this->debug('found proper separation of headers and document'); 03166 $this->debug('cleaned data, stringlen: '.strlen($data)); 03167 // clean headers 03168 foreach ($header_array as $header_line) { 03169 $arr = explode(':',$header_line,2); 03170 if(count($arr) > 1){ 03171 $header_name = strtolower(trim($arr[0])); 03172 $this->incoming_headers[$header_name] = trim($arr[1]); 03173 if ($header_name == 'set-cookie') { 03174 // TODO: allow multiple cookies from parseCookie 03175 $cookie = $this->parseCookie(trim($arr[1])); 03176 if ($cookie) { 03177 $this->incoming_cookies[] = $cookie; 03178 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); 03179 } else { 03180 $this->debug('did not find cookie in ' . trim($arr[1])); 03181 } 03182 } 03183 } else if (isset($header_name)) { 03184 // append continuation line to previous header 03185 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; 03186 } 03187 } 03188 } 03189 03190 $this->response_status_line = $header_array[0]; 03191 $arr = explode(' ', $this->response_status_line, 3); 03192 $http_version = $arr[0]; 03193 $http_status = intval($arr[1]); 03194 $http_reason = count($arr) > 2 ? $arr[2] : ''; 03195 03196 // see if we need to resend the request with http digest authentication 03197 if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { 03198 $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); 03199 $this->setURL($this->incoming_headers['location']); 03200 $this->tryagain = true; 03201 return false; 03202 } 03203 03204 // see if we need to resend the request with http digest authentication 03205 if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { 03206 $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); 03207 if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { 03208 $this->debug('Server wants digest authentication'); 03209 // remove "Digest " from our elements 03210 $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); 03211 03212 // parse elements into array 03213 $digestElements = explode(',', $digestString); 03214 foreach ($digestElements as $val) { 03215 $tempElement = explode('=', trim($val), 2); 03216 $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); 03217 } 03218 03219 // should have (at least) qop, realm, nonce 03220 if (isset($digestRequest['nonce'])) { 03221 $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); 03222 $this->tryagain = true; 03223 return false; 03224 } 03225 } 03226 $this->debug('HTTP authentication failed'); 03227 $this->setError('HTTP authentication failed'); 03228 return false; 03229 } 03230 03231 if ( 03232 ($http_status >= 300 && $http_status <= 307) || 03233 ($http_status >= 400 && $http_status <= 417) || 03234 ($http_status >= 501 && $http_status <= 505) 03235 ) { 03236 $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); 03237 return false; 03238 } 03239 03240 // decode content-encoding 03241 if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ 03242 if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ 03243 // if decoding works, use it. else assume data wasn't gzencoded 03244 if(function_exists('gzinflate')){ 03245 //$timer->setMarker('starting decoding of gzip/deflated content'); 03246 // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) 03247 // this means there are no Zlib headers, although there should be 03248 $this->debug('The gzinflate function exists'); 03249 $datalen = strlen($data); 03250 if ($this->incoming_headers['content-encoding'] == 'deflate') { 03251 if ($degzdata = @gzinflate($data)) { 03252 $data = $degzdata; 03253 $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); 03254 if (strlen($data) < $datalen) { 03255 // test for the case that the payload has been compressed twice 03256 $this->debug('The inflated payload is smaller than the gzipped one; try again'); 03257 if ($degzdata = @gzinflate($data)) { 03258 $data = $degzdata; 03259 $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); 03260 } 03261 } 03262 } else { 03263 $this->debug('Error using gzinflate to inflate the payload'); 03264 $this->setError('Error using gzinflate to inflate the payload'); 03265 } 03266 } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { 03267 if ($degzdata = @gzinflate(substr($data, 10))) { // do our best 03268 $data = $degzdata; 03269 $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); 03270 if (strlen($data) < $datalen) { 03271 // test for the case that the payload has been compressed twice 03272 $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); 03273 if ($degzdata = @gzinflate(substr($data, 10))) { 03274 $data = $degzdata; 03275 $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); 03276 } 03277 } 03278 } else { 03279 $this->debug('Error using gzinflate to un-gzip the payload'); 03280 $this->setError('Error using gzinflate to un-gzip the payload'); 03281 } 03282 } 03283 //$timer->setMarker('finished decoding of gzip/deflated content'); 03284 //print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>"; 03285 // set decoded payload 03286 $this->incoming_payload = $header_data.$lb.$lb.$data; 03287 } else { 03288 $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); 03289 $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); 03290 } 03291 } else { 03292 $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); 03293 $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); 03294 } 03295 } else { 03296 $this->debug('No Content-Encoding header'); 03297 } 03298 03299 if(strlen($data) == 0){ 03300 $this->debug('no data after headers!'); 03301 $this->setError('no data present after HTTP headers'); 03302 return false; 03303 } 03304 03305 return $data; 03306 }
soap_transport_http::getResponse | ( | ) |
gets the SOAP response via HTTP[S]
Definiert in Zeile 794 der Datei class.soap_transport_http.php.
00794 { 00795 $this->incoming_payload = ''; 00796 00797 if ($this->io_method() == 'socket') { 00798 // loop until headers have been retrieved 00799 $data = ''; 00800 while (!isset($lb)){ 00801 00802 // We might EOF during header read. 00803 if(feof($this->fp)) { 00804 $this->incoming_payload = $data; 00805 $this->debug('found no headers before EOF after length ' . strlen($data)); 00806 $this->debug("received before EOF:\n" . $data); 00807 $this->setError('server failed to send headers'); 00808 return false; 00809 } 00810 00811 $tmp = fgets($this->fp, 256); 00812 $tmplen = strlen($tmp); 00813 $this->debug("read line of $tmplen bytes: " . trim($tmp)); 00814 00815 if ($tmplen == 0) { 00816 $this->incoming_payload = $data; 00817 $this->debug('socket read of headers timed out after length ' . strlen($data)); 00818 $this->debug("read before timeout: " . $data); 00819 $this->setError('socket read of headers timed out'); 00820 return false; 00821 } 00822 00823 $data .= $tmp; 00824 $pos = strpos($data,"\r\n\r\n"); 00825 if($pos > 1){ 00826 $lb = "\r\n"; 00827 } else { 00828 $pos = strpos($data,"\n\n"); 00829 if($pos > 1){ 00830 $lb = "\n"; 00831 } 00832 } 00833 // remove 100 headers 00834 if (isset($lb) && ereg('^HTTP/1.1 100',$data)) { 00835 unset($lb); 00836 $data = ''; 00837 }// 00838 } 00839 // store header data 00840 $this->incoming_payload .= $data; 00841 $this->debug('found end of headers after length ' . strlen($data)); 00842 // process headers 00843 $header_data = trim(substr($data,0,$pos)); 00844 $header_array = explode($lb,$header_data); 00845 $this->incoming_headers = array(); 00846 $this->incoming_cookies = array(); 00847 foreach($header_array as $header_line){ 00848 $arr = explode(':',$header_line, 2); 00849 if(count($arr) > 1){ 00850 $header_name = strtolower(trim($arr[0])); 00851 $this->incoming_headers[$header_name] = trim($arr[1]); 00852 if ($header_name == 'set-cookie') { 00853 // TODO: allow multiple cookies from parseCookie 00854 $cookie = $this->parseCookie(trim($arr[1])); 00855 if ($cookie) { 00856 $this->incoming_cookies[] = $cookie; 00857 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); 00858 } else { 00859 $this->debug('did not find cookie in ' . trim($arr[1])); 00860 } 00861 } 00862 } else if (isset($header_name)) { 00863 // append continuation line to previous header 00864 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; 00865 } 00866 } 00867 00868 // loop until msg has been received 00869 if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { 00870 $content_length = 2147483647; // ignore any content-length header 00871 $chunked = true; 00872 $this->debug("want to read chunked content"); 00873 } elseif (isset($this->incoming_headers['content-length'])) { 00874 $content_length = $this->incoming_headers['content-length']; 00875 $chunked = false; 00876 $this->debug("want to read content of length $content_length"); 00877 } else { 00878 $content_length = 2147483647; 00879 $chunked = false; 00880 $this->debug("want to read content to EOF"); 00881 } 00882 $data = ''; 00883 do { 00884 if ($chunked) { 00885 $tmp = fgets($this->fp, 256); 00886 $tmplen = strlen($tmp); 00887 $this->debug("read chunk line of $tmplen bytes"); 00888 if ($tmplen == 0) { 00889 $this->incoming_payload = $data; 00890 $this->debug('socket read of chunk length timed out after length ' . strlen($data)); 00891 $this->debug("read before timeout:\n" . $data); 00892 $this->setError('socket read of chunk length timed out'); 00893 return false; 00894 } 00895 $content_length = hexdec(trim($tmp)); 00896 $this->debug("chunk length $content_length"); 00897 } 00898 $strlen = 0; 00899 while (($strlen < $content_length) && (!feof($this->fp))) { 00900 $readlen = min(8192, $content_length - $strlen); 00901 $tmp = fread($this->fp, $readlen); 00902 $tmplen = strlen($tmp); 00903 $this->debug("read buffer of $tmplen bytes"); 00904 if (($tmplen == 0) && (!feof($this->fp))) { 00905 $this->incoming_payload = $data; 00906 $this->debug('socket read of body timed out after length ' . strlen($data)); 00907 $this->debug("read before timeout:\n" . $data); 00908 $this->setError('socket read of body timed out'); 00909 return false; 00910 } 00911 $strlen += $tmplen; 00912 $data .= $tmp; 00913 } 00914 if ($chunked && ($content_length > 0)) { 00915 $tmp = fgets($this->fp, 256); 00916 $tmplen = strlen($tmp); 00917 $this->debug("read chunk terminator of $tmplen bytes"); 00918 if ($tmplen == 0) { 00919 $this->incoming_payload = $data; 00920 $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); 00921 $this->debug("read before timeout:\n" . $data); 00922 $this->setError('socket read of chunk terminator timed out'); 00923 return false; 00924 } 00925 } 00926 } while ($chunked && ($content_length > 0) && (!feof($this->fp))); 00927 if (feof($this->fp)) { 00928 $this->debug('read to EOF'); 00929 } 00930 $this->debug('read body of length ' . strlen($data)); 00931 $this->incoming_payload .= $data; 00932 $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); 00933 00934 // close filepointer 00935 if( 00936 (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 00937 (! $this->persistentConnection) || feof($this->fp)){ 00938 fclose($this->fp); 00939 $this->fp = false; 00940 $this->debug('closed socket'); 00941 } 00942 00943 // connection was closed unexpectedly 00944 if($this->incoming_payload == ''){ 00945 $this->setError('no response from server'); 00946 return false; 00947 } 00948 00949 // decode transfer-encoding 00950 // if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ 00951 // if(!$data = $this->decodeChunked($data, $lb)){ 00952 // $this->setError('Decoding of chunked data failed'); 00953 // return false; 00954 // } 00955 //print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>"; 00956 // set decoded payload 00957 // $this->incoming_payload = $header_data.$lb.$lb.$data; 00958 // } 00959 00960 } else if ($this->io_method() == 'curl') { 00961 // send and receive 00962 $this->debug('send and receive with cURL'); 00963 $this->incoming_payload = curl_exec($this->ch); 00964 $data = $this->incoming_payload; 00965 00966 $cErr = curl_error($this->ch); 00967 if ($cErr != '') { 00968 $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>'; 00969 // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE 00970 foreach(curl_getinfo($this->ch) as $k => $v){ 00971 $err .= "$k: $v<br>"; 00972 } 00973 $this->debug($err); 00974 $this->setError($err); 00975 curl_close($this->ch); 00976 return false; 00977 } else { 00978 //echo '<pre>'; 00979 //var_dump(curl_getinfo($this->ch)); 00980 //echo '</pre>'; 00981 } 00982 // close curl 00983 $this->debug('No cURL error, closing cURL'); 00984 curl_close($this->ch); 00985 00986 // try removing skippable headers 00987 $savedata = $data; 00988 while ($this->isSkippableCurlHeader($data)) { 00989 $this->debug("Found HTTP header to skip"); 00990 if ($pos = strpos($data,"\r\n\r\n")) { 00991 $data = ltrim(substr($data,$pos)); 00992 } elseif($pos = strpos($data,"\n\n") ) { 00993 $data = ltrim(substr($data,$pos)); 00994 } 00995 } 00996 00997 if ($data == '') { 00998 // have nothing left; just remove 100 header(s) 00999 $data = $savedata; 01000 while (ereg('^HTTP/1.1 100',$data)) { 01001 if ($pos = strpos($data,"\r\n\r\n")) { 01002 $data = ltrim(substr($data,$pos)); 01003 } elseif($pos = strpos($data,"\n\n") ) { 01004 $data = ltrim(substr($data,$pos)); 01005 } 01006 } 01007 } 01008 01009 // separate content from HTTP headers 01010 if ($pos = strpos($data,"\r\n\r\n")) { 01011 $lb = "\r\n"; 01012 } elseif( $pos = strpos($data,"\n\n")) { 01013 $lb = "\n"; 01014 } else { 01015 $this->debug('no proper separation of headers and document'); 01016 $this->setError('no proper separation of headers and document'); 01017 return false; 01018 } 01019 $header_data = trim(substr($data,0,$pos)); 01020 $header_array = explode($lb,$header_data); 01021 $data = ltrim(substr($data,$pos)); 01022 $this->debug('found proper separation of headers and document'); 01023 $this->debug('cleaned data, stringlen: '.strlen($data)); 01024 // clean headers 01025 foreach ($header_array as $header_line) { 01026 $arr = explode(':',$header_line,2); 01027 if(count($arr) > 1){ 01028 $header_name = strtolower(trim($arr[0])); 01029 $this->incoming_headers[$header_name] = trim($arr[1]); 01030 if ($header_name == 'set-cookie') { 01031 // TODO: allow multiple cookies from parseCookie 01032 $cookie = $this->parseCookie(trim($arr[1])); 01033 if ($cookie) { 01034 $this->incoming_cookies[] = $cookie; 01035 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); 01036 } else { 01037 $this->debug('did not find cookie in ' . trim($arr[1])); 01038 } 01039 } 01040 } else if (isset($header_name)) { 01041 // append continuation line to previous header 01042 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; 01043 } 01044 } 01045 } 01046 01047 $this->response_status_line = $header_array[0]; 01048 $arr = explode(' ', $this->response_status_line, 3); 01049 $http_version = $arr[0]; 01050 $http_status = intval($arr[1]); 01051 $http_reason = count($arr) > 2 ? $arr[2] : ''; 01052 01053 // see if we need to resend the request with http digest authentication 01054 if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { 01055 $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); 01056 $this->setURL($this->incoming_headers['location']); 01057 $this->tryagain = true; 01058 return false; 01059 } 01060 01061 // see if we need to resend the request with http digest authentication 01062 if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { 01063 $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); 01064 if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { 01065 $this->debug('Server wants digest authentication'); 01066 // remove "Digest " from our elements 01067 $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); 01068 01069 // parse elements into array 01070 $digestElements = explode(',', $digestString); 01071 foreach ($digestElements as $val) { 01072 $tempElement = explode('=', trim($val), 2); 01073 $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); 01074 } 01075 01076 // should have (at least) qop, realm, nonce 01077 if (isset($digestRequest['nonce'])) { 01078 $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); 01079 $this->tryagain = true; 01080 return false; 01081 } 01082 } 01083 $this->debug('HTTP authentication failed'); 01084 $this->setError('HTTP authentication failed'); 01085 return false; 01086 } 01087 01088 if ( 01089 ($http_status >= 300 && $http_status <= 307) || 01090 ($http_status >= 400 && $http_status <= 417) || 01091 ($http_status >= 501 && $http_status <= 505) 01092 ) { 01093 $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); 01094 return false; 01095 } 01096 01097 // decode content-encoding 01098 if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ 01099 if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ 01100 // if decoding works, use it. else assume data wasn't gzencoded 01101 if(function_exists('gzinflate')){ 01102 //$timer->setMarker('starting decoding of gzip/deflated content'); 01103 // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) 01104 // this means there are no Zlib headers, although there should be 01105 $this->debug('The gzinflate function exists'); 01106 $datalen = strlen($data); 01107 if ($this->incoming_headers['content-encoding'] == 'deflate') { 01108 if ($degzdata = @gzinflate($data)) { 01109 $data = $degzdata; 01110 $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); 01111 if (strlen($data) < $datalen) { 01112 // test for the case that the payload has been compressed twice 01113 $this->debug('The inflated payload is smaller than the gzipped one; try again'); 01114 if ($degzdata = @gzinflate($data)) { 01115 $data = $degzdata; 01116 $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); 01117 } 01118 } 01119 } else { 01120 $this->debug('Error using gzinflate to inflate the payload'); 01121 $this->setError('Error using gzinflate to inflate the payload'); 01122 } 01123 } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { 01124 if ($degzdata = @gzinflate(substr($data, 10))) { // do our best 01125 $data = $degzdata; 01126 $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); 01127 if (strlen($data) < $datalen) { 01128 // test for the case that the payload has been compressed twice 01129 $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); 01130 if ($degzdata = @gzinflate(substr($data, 10))) { 01131 $data = $degzdata; 01132 $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); 01133 } 01134 } 01135 } else { 01136 $this->debug('Error using gzinflate to un-gzip the payload'); 01137 $this->setError('Error using gzinflate to un-gzip the payload'); 01138 } 01139 } 01140 //$timer->setMarker('finished decoding of gzip/deflated content'); 01141 //print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>"; 01142 // set decoded payload 01143 $this->incoming_payload = $header_data.$lb.$lb.$data; 01144 } else { 01145 $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); 01146 $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); 01147 } 01148 } else { 01149 $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); 01150 $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); 01151 } 01152 } else { 01153 $this->debug('No Content-Encoding header'); 01154 } 01155 01156 if(strlen($data) == 0){ 01157 $this->debug('no data after headers!'); 01158 $this->setError('no data present after HTTP headers'); 01159 return false; 01160 } 01161 01162 return $data; 01163 }
soap_transport_http::io_method | ( | ) |
gets the I/O method to use
Definiert in Zeile 2304 der Datei nusoap.php.
02304 { 02305 if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) 02306 return 'curl'; 02307 if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) 02308 return 'socket'; 02309 return 'unknown'; 02310 }
soap_transport_http::io_method | ( | ) |
gets the I/O method to use
Definiert in Zeile 161 der Datei class.soap_transport_http.php.
00161 { 00162 if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) 00163 return 'curl'; 00164 if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) 00165 return 'socket'; 00166 return 'unknown'; 00167 }
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.
string | $data The string to check. |
Definiert in Zeile 2747 der Datei nusoap.php.
02747 { 02748 $skipHeaders = array( 'HTTP/1.1 100', 02749 'HTTP/1.0 301', 02750 'HTTP/1.1 301', 02751 'HTTP/1.0 302', 02752 'HTTP/1.1 302', 02753 'HTTP/1.0 401', 02754 'HTTP/1.1 401', 02755 'HTTP/1.0 200 Connection established'); 02756 foreach ($skipHeaders as $hd) { 02757 $prefix = substr($data, 0, strlen($hd)); 02758 if ($prefix == $hd) return true; 02759 } 02760 02761 return false; 02762 }
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.
string | $data The string to check. |
Definiert in Zeile 604 der Datei class.soap_transport_http.php.
00604 { 00605 $skipHeaders = array( 'HTTP/1.1 100', 00606 'HTTP/1.0 301', 00607 'HTTP/1.1 301', 00608 'HTTP/1.0 302', 00609 'HTTP/1.1 302', 00610 'HTTP/1.0 401', 00611 'HTTP/1.1 401', 00612 'HTTP/1.0 200 Connection established'); 00613 foreach ($skipHeaders as $hd) { 00614 $prefix = substr($data, 0, strlen($hd)); 00615 if ($prefix == $hd) return true; 00616 } 00617 00618 return false; 00619 }
soap_transport_http::parseCookie | ( | $ | cookie_str | ) |
parse an incoming Cookie into it's parts
string | $cookie_str content of cookie |
Definiert in Zeile 3345 der Datei nusoap.php.
03345 { 03346 $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; 03347 $data = split(';', $cookie_str); 03348 $value_str = $data[0]; 03349 03350 $cookie_param = 'domain='; 03351 $start = strpos($cookie_str, $cookie_param); 03352 if ($start > 0) { 03353 $domain = substr($cookie_str, $start + strlen($cookie_param)); 03354 $domain = substr($domain, 0, strpos($domain, ';')); 03355 } else { 03356 $domain = ''; 03357 } 03358 03359 $cookie_param = 'expires='; 03360 $start = strpos($cookie_str, $cookie_param); 03361 if ($start > 0) { 03362 $expires = substr($cookie_str, $start + strlen($cookie_param)); 03363 $expires = substr($expires, 0, strpos($expires, ';')); 03364 } else { 03365 $expires = ''; 03366 } 03367 03368 $cookie_param = 'path='; 03369 $start = strpos($cookie_str, $cookie_param); 03370 if ( $start > 0 ) { 03371 $path = substr($cookie_str, $start + strlen($cookie_param)); 03372 $path = substr($path, 0, strpos($path, ';')); 03373 } else { 03374 $path = '/'; 03375 } 03376 03377 $cookie_param = ';secure;'; 03378 if (strpos($cookie_str, $cookie_param) !== FALSE) { 03379 $secure = true; 03380 } else { 03381 $secure = false; 03382 } 03383 03384 $sep_pos = strpos($value_str, '='); 03385 03386 if ($sep_pos) { 03387 $name = substr($value_str, 0, $sep_pos); 03388 $value = substr($value_str, $sep_pos + 1); 03389 $cookie= array( 'name' => $name, 03390 'value' => $value, 03391 'domain' => $domain, 03392 'path' => $path, 03393 'expires' => $expires, 03394 'secure' => $secure 03395 ); 03396 return $cookie; 03397 } 03398 return false; 03399 }
soap_transport_http::parseCookie | ( | $ | cookie_str | ) |
parse an incoming Cookie into it's parts
string | $cookie_str content of cookie |
Definiert in Zeile 1202 der Datei class.soap_transport_http.php.
01202 { 01203 $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; 01204 $data = split(';', $cookie_str); 01205 $value_str = $data[0]; 01206 01207 $cookie_param = 'domain='; 01208 $start = strpos($cookie_str, $cookie_param); 01209 if ($start > 0) { 01210 $domain = substr($cookie_str, $start + strlen($cookie_param)); 01211 $domain = substr($domain, 0, strpos($domain, ';')); 01212 } else { 01213 $domain = ''; 01214 } 01215 01216 $cookie_param = 'expires='; 01217 $start = strpos($cookie_str, $cookie_param); 01218 if ($start > 0) { 01219 $expires = substr($cookie_str, $start + strlen($cookie_param)); 01220 $expires = substr($expires, 0, strpos($expires, ';')); 01221 } else { 01222 $expires = ''; 01223 } 01224 01225 $cookie_param = 'path='; 01226 $start = strpos($cookie_str, $cookie_param); 01227 if ( $start > 0 ) { 01228 $path = substr($cookie_str, $start + strlen($cookie_param)); 01229 $path = substr($path, 0, strpos($path, ';')); 01230 } else { 01231 $path = '/'; 01232 } 01233 01234 $cookie_param = ';secure;'; 01235 if (strpos($cookie_str, $cookie_param) !== FALSE) { 01236 $secure = true; 01237 } else { 01238 $secure = false; 01239 } 01240 01241 $sep_pos = strpos($value_str, '='); 01242 01243 if ($sep_pos) { 01244 $name = substr($value_str, 0, $sep_pos); 01245 $value = substr($value_str, $sep_pos + 1); 01246 $cookie= array( 'name' => $name, 01247 'value' => $value, 01248 'domain' => $domain, 01249 'path' => $path, 01250 'expires' => $expires, 01251 'secure' => $secure 01252 ); 01253 return $cookie; 01254 } 01255 return false; 01256 }
soap_transport_http::send | ( | $ | data, | |
$ | timeout = 0 , |
|||
$ | response_timeout = 30 , |
|||
$ | cookies = NULL | |||
) |
sends the SOAP request and gets the SOAP response via HTTP[S]
string | $data message data | |
integer | $timeout set connection timeout in seconds | |
integer | $response_timeout set response timeout in seconds | |
array | $cookies cookies to send |
Definiert in Zeile 2556 der Datei nusoap.php.
02556 { 02557 02558 $this->debug('entered send() with data of length: '.strlen($data)); 02559 02560 $this->tryagain = true; 02561 $tries = 0; 02562 while ($this->tryagain) { 02563 $this->tryagain = false; 02564 if ($tries++ < 2) { 02565 // make connnection 02566 if (!$this->connect($timeout, $response_timeout)){ 02567 return false; 02568 } 02569 02570 // send request 02571 if (!$this->sendRequest($data, $cookies)){ 02572 return false; 02573 } 02574 02575 // get response 02576 $respdata = $this->getResponse(); 02577 } else { 02578 $this->setError("Too many tries to get an OK response ($this->response_status_line)"); 02579 } 02580 } 02581 $this->debug('end of send()'); 02582 return $respdata; 02583 }
soap_transport_http::send | ( | $ | data, | |
$ | timeout = 0 , |
|||
$ | response_timeout = 30 , |
|||
$ | cookies = NULL | |||
) |
sends the SOAP request and gets the SOAP response via HTTP[S]
string | $data message data | |
integer | $timeout set connection timeout in seconds | |
integer | $response_timeout set response timeout in seconds | |
array | $cookies cookies to send |
Definiert in Zeile 413 der Datei class.soap_transport_http.php.
00413 { 00414 00415 $this->debug('entered send() with data of length: '.strlen($data)); 00416 00417 $this->tryagain = true; 00418 $tries = 0; 00419 while ($this->tryagain) { 00420 $this->tryagain = false; 00421 if ($tries++ < 2) { 00422 // make connnection 00423 if (!$this->connect($timeout, $response_timeout)){ 00424 return false; 00425 } 00426 00427 // send request 00428 if (!$this->sendRequest($data, $cookies)){ 00429 return false; 00430 } 00431 00432 // get response 00433 $respdata = $this->getResponse(); 00434 } else { 00435 $this->setError("Too many tries to get an OK response ($this->response_status_line)"); 00436 } 00437 } 00438 $this->debug('end of send()'); 00439 return $respdata; 00440 }
soap_transport_http::sendHTTPS | ( | $ | data, | |
$ | timeout = 0 , |
|||
$ | response_timeout = 30 , |
|||
$ | cookies | |||
) |
sends the SOAP request and gets the SOAP response via HTTPS using CURL
string | $data message data | |
integer | $timeout set connection timeout in seconds | |
integer | $response_timeout set response timeout in seconds | |
array | $cookies cookies to send |
Definiert in Zeile 2597 der Datei nusoap.php.
02597 { 02598 return $this->send($data, $timeout, $response_timeout, $cookies); 02599 }
soap_transport_http::sendHTTPS | ( | $ | data, | |
$ | timeout = 0 , |
|||
$ | response_timeout = 30 , |
|||
$ | cookies | |||
) |
sends the SOAP request and gets the SOAP response via HTTPS using CURL
string | $data message data | |
integer | $timeout set connection timeout in seconds | |
integer | $response_timeout set response timeout in seconds | |
array | $cookies cookies to send |
Definiert in Zeile 454 der Datei class.soap_transport_http.php.
00454 { 00455 return $this->send($data, $timeout, $response_timeout, $cookies); 00456 }
soap_transport_http::sendRequest | ( | $ | data, | |
$ | cookies = NULL | |||
) |
sends the SOAP request via HTTP[S]
string | $data message data | |
array | $cookies cookies to send |
Definiert in Zeile 2880 der Datei nusoap.php.
02880 { 02881 // build cookie string 02882 $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); 02883 02884 // build payload 02885 $this->buildPayload($data, $cookie_str); 02886 02887 if ($this->io_method() == 'socket') { 02888 // send payload 02889 if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { 02890 $this->setError('couldn\'t write message data to socket'); 02891 $this->debug('couldn\'t write message data to socket'); 02892 return false; 02893 } 02894 $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); 02895 return true; 02896 } else if ($this->io_method() == 'curl') { 02897 // set payload 02898 // cURL does say this should only be the verb, and in fact it 02899 // turns out that the URI and HTTP version are appended to this, which 02900 // some servers refuse to work with (so we no longer use this method!) 02901 //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); 02902 $curl_headers = array(); 02903 foreach($this->outgoing_headers as $k => $v){ 02904 if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { 02905 $this->debug("Skip cURL header $k: $v"); 02906 } else { 02907 $curl_headers[] = "$k: $v"; 02908 } 02909 } 02910 if ($cookie_str != '') { 02911 $curl_headers[] = 'Cookie: ' . $cookie_str; 02912 } 02913 $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); 02914 $this->debug('set cURL HTTP headers'); 02915 if ($this->request_method == "POST") { 02916 $this->setCurlOption(CURLOPT_POST, 1); 02917 $this->setCurlOption(CURLOPT_POSTFIELDS, $data); 02918 $this->debug('set cURL POST data'); 02919 } else { 02920 } 02921 // insert custom user-set cURL options 02922 foreach ($this->ch_options as $key => $val) { 02923 $this->setCurlOption($key, $val); 02924 } 02925 02926 $this->debug('set cURL payload'); 02927 return true; 02928 } 02929 }
soap_transport_http::sendRequest | ( | $ | data, | |
$ | cookies = NULL | |||
) |
sends the SOAP request via HTTP[S]
string | $data message data | |
array | $cookies cookies to send |
Definiert in Zeile 737 der Datei class.soap_transport_http.php.
00737 { 00738 // build cookie string 00739 $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); 00740 00741 // build payload 00742 $this->buildPayload($data, $cookie_str); 00743 00744 if ($this->io_method() == 'socket') { 00745 // send payload 00746 if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { 00747 $this->setError('couldn\'t write message data to socket'); 00748 $this->debug('couldn\'t write message data to socket'); 00749 return false; 00750 } 00751 $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); 00752 return true; 00753 } else if ($this->io_method() == 'curl') { 00754 // set payload 00755 // cURL does say this should only be the verb, and in fact it 00756 // turns out that the URI and HTTP version are appended to this, which 00757 // some servers refuse to work with (so we no longer use this method!) 00758 //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); 00759 $curl_headers = array(); 00760 foreach($this->outgoing_headers as $k => $v){ 00761 if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { 00762 $this->debug("Skip cURL header $k: $v"); 00763 } else { 00764 $curl_headers[] = "$k: $v"; 00765 } 00766 } 00767 if ($cookie_str != '') { 00768 $curl_headers[] = 'Cookie: ' . $cookie_str; 00769 } 00770 $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); 00771 $this->debug('set cURL HTTP headers'); 00772 if ($this->request_method == "POST") { 00773 $this->setCurlOption(CURLOPT_POST, 1); 00774 $this->setCurlOption(CURLOPT_POSTFIELDS, $data); 00775 $this->debug('set cURL POST data'); 00776 } else { 00777 } 00778 // insert custom user-set cURL options 00779 foreach ($this->ch_options as $key => $val) { 00780 $this->setCurlOption($key, $val); 00781 } 00782 00783 $this->debug('set cURL payload'); 00784 return true; 00785 } 00786 }
soap_transport_http::setContentType | ( | $ | type, | |
$ | charset = false | |||
) |
sets the content-type for the SOAP message to be sent
string | $type the content type, MIME style | |
mixed | $charset character set used for encoding (or false) public |
Definiert in Zeile 3315 der Datei nusoap.php.
03315 { 03316 $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); 03317 }
soap_transport_http::setContentType | ( | $ | type, | |
$ | charset = false | |||
) |
sets the content-type for the SOAP message to be sent
string | $type the content type, MIME style | |
mixed | $charset character set used for encoding (or false) public |
Definiert in Zeile 1172 der Datei class.soap_transport_http.php.
01172 { 01173 $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); 01174 }
soap_transport_http::setCredentials | ( | $ | username, | |
$ | password, | |||
$ | authtype = 'basic' , |
|||
$ | digestRequest = array() , |
|||
$ | certRequest = array() | |||
) |
if authenticating, set user credentials here
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 |
Definiert in Zeile 2611 der Datei nusoap.php.
02611 { 02612 $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); 02613 $this->appendDebug($this->varDump($digestRequest)); 02614 $this->debug("certRequest="); 02615 $this->appendDebug($this->varDump($certRequest)); 02616 // cf. RFC 2617 02617 if ($authtype == 'basic') { 02618 $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); 02619 } elseif ($authtype == 'digest') { 02620 if (isset($digestRequest['nonce'])) { 02621 $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; 02622 02623 // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) 02624 02625 // A1 = unq(username-value) ":" unq(realm-value) ":" passwd 02626 $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; 02627 02628 // H(A1) = MD5(A1) 02629 $HA1 = md5($A1); 02630 02631 // A2 = Method ":" digest-uri-value 02632 $A2 = $this->request_method . ':' . $this->digest_uri; 02633 02634 // H(A2) 02635 $HA2 = md5($A2); 02636 02637 // KD(secret, data) = H(concat(secret, ":", data)) 02638 // if qop == auth: 02639 // request-digest = <"> < KD ( H(A1), unq(nonce-value) 02640 // ":" nc-value 02641 // ":" unq(cnonce-value) 02642 // ":" unq(qop-value) 02643 // ":" H(A2) 02644 // ) <"> 02645 // if qop is missing, 02646 // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> 02647 02648 $unhashedDigest = ''; 02649 $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; 02650 $cnonce = $nonce; 02651 if ($digestRequest['qop'] != '') { 02652 $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; 02653 } else { 02654 $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; 02655 } 02656 02657 $hashedDigest = md5($unhashedDigest); 02658 02659 $opaque = ''; 02660 if (isset($digestRequest['opaque'])) { 02661 $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; 02662 } 02663 02664 $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 . '"'); 02665 } 02666 } elseif ($authtype == 'certificate') { 02667 $this->certRequest = $certRequest; 02668 $this->debug('Authorization header not set for certificate'); 02669 } elseif ($authtype == 'ntlm') { 02670 // do nothing 02671 $this->debug('Authorization header not set for ntlm'); 02672 } 02673 $this->username = $username; 02674 $this->password = $password; 02675 $this->authtype = $authtype; 02676 $this->digestRequest = $digestRequest; 02677 }
soap_transport_http::setCredentials | ( | $ | username, | |
$ | password, | |||
$ | authtype = 'basic' , |
|||
$ | digestRequest = array() , |
|||
$ | certRequest = array() | |||
) |
if authenticating, set user credentials here
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 |
Definiert in Zeile 468 der Datei class.soap_transport_http.php.
00468 { 00469 $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); 00470 $this->appendDebug($this->varDump($digestRequest)); 00471 $this->debug("certRequest="); 00472 $this->appendDebug($this->varDump($certRequest)); 00473 // cf. RFC 2617 00474 if ($authtype == 'basic') { 00475 $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); 00476 } elseif ($authtype == 'digest') { 00477 if (isset($digestRequest['nonce'])) { 00478 $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; 00479 00480 // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) 00481 00482 // A1 = unq(username-value) ":" unq(realm-value) ":" passwd 00483 $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; 00484 00485 // H(A1) = MD5(A1) 00486 $HA1 = md5($A1); 00487 00488 // A2 = Method ":" digest-uri-value 00489 $A2 = $this->request_method . ':' . $this->digest_uri; 00490 00491 // H(A2) 00492 $HA2 = md5($A2); 00493 00494 // KD(secret, data) = H(concat(secret, ":", data)) 00495 // if qop == auth: 00496 // request-digest = <"> < KD ( H(A1), unq(nonce-value) 00497 // ":" nc-value 00498 // ":" unq(cnonce-value) 00499 // ":" unq(qop-value) 00500 // ":" H(A2) 00501 // ) <"> 00502 // if qop is missing, 00503 // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> 00504 00505 $unhashedDigest = ''; 00506 $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; 00507 $cnonce = $nonce; 00508 if ($digestRequest['qop'] != '') { 00509 $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; 00510 } else { 00511 $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; 00512 } 00513 00514 $hashedDigest = md5($unhashedDigest); 00515 00516 $opaque = ''; 00517 if (isset($digestRequest['opaque'])) { 00518 $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; 00519 } 00520 00521 $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 . '"'); 00522 } 00523 } elseif ($authtype == 'certificate') { 00524 $this->certRequest = $certRequest; 00525 $this->debug('Authorization header not set for certificate'); 00526 } elseif ($authtype == 'ntlm') { 00527 // do nothing 00528 $this->debug('Authorization header not set for ntlm'); 00529 } 00530 $this->username = $username; 00531 $this->password = $password; 00532 $this->authtype = $authtype; 00533 $this->digestRequest = $digestRequest; 00534 }
soap_transport_http::setCurlOption | ( | $ | option, | |
$ | value | |||
) |
sets a cURL option
mixed | $option The cURL option (always integer?) | |
mixed | $value The cURL option value private |
Definiert in Zeile 2223 der Datei nusoap.php.
02223 { 02224 $this->debug("setCurlOption option=$option, value="); 02225 $this->appendDebug($this->varDump($value)); 02226 curl_setopt($this->ch, $option, $value); 02227 }
soap_transport_http::setCurlOption | ( | $ | option, | |
$ | value | |||
) |
sets a cURL option
mixed | $option The cURL option (always integer?) | |
mixed | $value The cURL option value private |
Definiert in Zeile 80 der Datei class.soap_transport_http.php.
00080 { 00081 $this->debug("setCurlOption option=$option, value="); 00082 $this->appendDebug($this->varDump($value)); 00083 curl_setopt($this->ch, $option, $value); 00084 }
soap_transport_http::setEncoding | ( | $ | enc = 'gzip , |
|
deflate' | ||||
) |
use http encoding
string | $enc encoding style. supported values: gzip, deflate, or both public |
Definiert in Zeile 2695 der Datei nusoap.php.
02695 { 02696 if (function_exists('gzdeflate')) { 02697 $this->protocol_version = '1.1'; 02698 $this->setHeader('Accept-Encoding', $enc); 02699 if (!isset($this->outgoing_headers['Connection'])) { 02700 $this->setHeader('Connection', 'close'); 02701 $this->persistentConnection = false; 02702 } 02703 set_magic_quotes_runtime(0); 02704 // deprecated 02705 $this->encoding = $enc; 02706 } 02707 }
soap_transport_http::setEncoding | ( | $ | enc = 'gzip , |
|
deflate' | ||||
) |
use http encoding
string | $enc encoding style. supported values: gzip, deflate, or both public |
Definiert in Zeile 552 der Datei class.soap_transport_http.php.
00552 { 00553 if (function_exists('gzdeflate')) { 00554 $this->protocol_version = '1.1'; 00555 $this->setHeader('Accept-Encoding', $enc); 00556 if (!isset($this->outgoing_headers['Connection'])) { 00557 $this->setHeader('Connection', 'close'); 00558 $this->persistentConnection = false; 00559 } 00560 set_magic_quotes_runtime(0); 00561 // deprecated 00562 $this->encoding = $enc; 00563 } 00564 }
soap_transport_http::setHeader | ( | $ | name, | |
$ | value | |||
) |
sets an HTTP header
string | $name The name of the header | |
string | $value The value of the header private |
Definiert in Zeile 2236 der Datei nusoap.php.
02236 { 02237 $this->outgoing_headers[$name] = $value; 02238 $this->debug("set header $name: $value"); 02239 }
soap_transport_http::setHeader | ( | $ | name, | |
$ | value | |||
) |
sets an HTTP header
string | $name The name of the header | |
string | $value The value of the header private |
Definiert in Zeile 93 der Datei class.soap_transport_http.php.
00093 { 00094 $this->outgoing_headers[$name] = $value; 00095 $this->debug("set header $name: $value"); 00096 }
soap_transport_http::setProxy | ( | $ | proxyhost, | |
$ | proxyport, | |||
$ | proxyusername = '' , |
|||
$ | proxypassword = '' , |
|||
$ | proxyauthtype = 'basic' | |||
) |
set proxy info here
string | $proxyhost use an empty string to remove proxy | |
string | $proxyport | |
string | $proxyusername | |
string | $proxypassword | |
string | $proxyauthtype (basic|ntlm) public |
Definiert in Zeile 2719 der Datei nusoap.php.
02719 { 02720 if ($proxyhost) { 02721 $this->proxy = array( 02722 'host' => $proxyhost, 02723 'port' => $proxyport, 02724 'username' => $proxyusername, 02725 'password' => $proxypassword, 02726 'authtype' => $proxyauthtype 02727 ); 02728 if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { 02729 $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); 02730 } 02731 } else { 02732 $this->debug('remove proxy'); 02733 $proxy = null; 02734 unsetHeader('Proxy-Authorization'); 02735 } 02736 }
soap_transport_http::setProxy | ( | $ | proxyhost, | |
$ | proxyport, | |||
$ | proxyusername = '' , |
|||
$ | proxypassword = '' , |
|||
$ | proxyauthtype = 'basic' | |||
) |
set proxy info here
string | $proxyhost use an empty string to remove proxy | |
string | $proxyport | |
string | $proxyusername | |
string | $proxypassword | |
string | $proxyauthtype (basic|ntlm) public |
Definiert in Zeile 576 der Datei class.soap_transport_http.php.
00576 { 00577 if ($proxyhost) { 00578 $this->proxy = array( 00579 'host' => $proxyhost, 00580 'port' => $proxyport, 00581 'username' => $proxyusername, 00582 'password' => $proxypassword, 00583 'authtype' => $proxyauthtype 00584 ); 00585 if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { 00586 $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); 00587 } 00588 } else { 00589 $this->debug('remove proxy'); 00590 $proxy = null; 00591 unsetHeader('Proxy-Authorization'); 00592 } 00593 }
soap_transport_http::setSOAPAction | ( | $ | soapaction | ) |
set the soapaction value
string | $soapaction public |
Definiert in Zeile 2685 der Datei nusoap.php.
02685 { 02686 $this->setHeader('SOAPAction', '"' . $soapaction . '"'); 02687 }
soap_transport_http::setSOAPAction | ( | $ | soapaction | ) |
set the soapaction value
string | $soapaction public |
Definiert in Zeile 542 der Datei class.soap_transport_http.php.
00542 { 00543 $this->setHeader('SOAPAction', '"' . $soapaction . '"'); 00544 }
soap_transport_http::setURL | ( | $ | url | ) |
sets the URL to which to connect
string | $url The URL to which to connect private |
Definiert in Zeile 2260 der Datei nusoap.php.
02260 { 02261 $this->url = $url; 02262 02263 $u = parse_url($url); 02264 foreach($u as $k => $v){ 02265 $this->debug("parsed URL $k = $v"); 02266 $this->$k = $v; 02267 } 02268 02269 // add any GET params to path 02270 if(isset($u['query']) && $u['query'] != ''){ 02271 $this->path .= '?' . $u['query']; 02272 } 02273 02274 // set default port 02275 if(!isset($u['port'])){ 02276 if($u['scheme'] == 'https'){ 02277 $this->port = 443; 02278 } else { 02279 $this->port = 80; 02280 } 02281 } 02282 02283 $this->uri = $this->path; 02284 $this->digest_uri = $this->uri; 02285 02286 // build headers 02287 if (!isset($u['port'])) { 02288 $this->setHeader('Host', $this->host); 02289 } else { 02290 $this->setHeader('Host', $this->host.':'.$this->port); 02291 } 02292 02293 if (isset($u['user']) && $u['user'] != '') { 02294 $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); 02295 } 02296 }
soap_transport_http::setURL | ( | $ | url | ) |
sets the URL to which to connect
string | $url The URL to which to connect private |
Definiert in Zeile 117 der Datei class.soap_transport_http.php.
00117 { 00118 $this->url = $url; 00119 00120 $u = parse_url($url); 00121 foreach($u as $k => $v){ 00122 $this->debug("parsed URL $k = $v"); 00123 $this->$k = $v; 00124 } 00125 00126 // add any GET params to path 00127 if(isset($u['query']) && $u['query'] != ''){ 00128 $this->path .= '?' . $u['query']; 00129 } 00130 00131 // set default port 00132 if(!isset($u['port'])){ 00133 if($u['scheme'] == 'https'){ 00134 $this->port = 443; 00135 } else { 00136 $this->port = 80; 00137 } 00138 } 00139 00140 $this->uri = $this->path; 00141 $this->digest_uri = $this->uri; 00142 00143 // build headers 00144 if (!isset($u['port'])) { 00145 $this->setHeader('Host', $this->host); 00146 } else { 00147 $this->setHeader('Host', $this->host.':'.$this->port); 00148 } 00149 00150 if (isset($u['user']) && $u['user'] != '') { 00151 $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); 00152 } 00153 }
soap_transport_http::soap_transport_http | ( | $ | url, | |
$ | curl_options = NULL , |
|||
$ | use_curl = false | |||
) |
constructor
string | $url The URL to which to connect | |
array | $curl_options User-specified cURL options | |
boolean | $use_curl Whether to try to force cURL use public |
Definiert in Zeile 2203 der Datei nusoap.php.
02203 { 02204 parent::nusoap_base(); 02205 $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); 02206 $this->appendDebug($this->varDump($curl_options)); 02207 $this->setURL($url); 02208 if (is_array($curl_options)) { 02209 $this->ch_options = $curl_options; 02210 } 02211 $this->use_curl = $use_curl; 02212 ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev); 02213 $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); 02214 }
soap_transport_http::soap_transport_http | ( | $ | url, | |
$ | curl_options = NULL , |
|||
$ | use_curl = false | |||
) |
constructor
string | $url The URL to which to connect | |
array | $curl_options User-specified cURL options | |
boolean | $use_curl Whether to try to force cURL use public |
Definiert in Zeile 60 der Datei class.soap_transport_http.php.
00060 { 00061 parent::nusoap_base(); 00062 $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); 00063 $this->appendDebug($this->varDump($curl_options)); 00064 $this->setURL($url); 00065 if (is_array($curl_options)) { 00066 $this->ch_options = $curl_options; 00067 } 00068 $this->use_curl = $use_curl; 00069 ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev); 00070 $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); 00071 }
soap_transport_http::unsetHeader | ( | $ | name | ) |
unsets an HTTP header
string | $name The name of the header private |
Definiert in Zeile 2247 der Datei nusoap.php.
02247 { 02248 if (isset($this->outgoing_headers[$name])) { 02249 $this->debug("unset header $name"); 02250 unset($this->outgoing_headers[$name]); 02251 } 02252 }
soap_transport_http::unsetHeader | ( | $ | name | ) |
unsets an HTTP header
string | $name The name of the header private |
Definiert in Zeile 104 der Datei class.soap_transport_http.php.
00104 { 00105 if (isset($this->outgoing_headers[$name])) { 00106 $this->debug("unset header $name"); 00107 unset($this->outgoing_headers[$name]); 00108 } 00109 }
soap_transport_http::usePersistentConnection | ( | ) |
specifies that an HTTP persistent connection should be used
Definiert in Zeile 3325 der Datei nusoap.php.
03325 { 03326 if (isset($this->outgoing_headers['Accept-Encoding'])) { 03327 return false; 03328 } 03329 $this->protocol_version = '1.1'; 03330 $this->persistentConnection = true; 03331 $this->setHeader('Connection', 'Keep-Alive'); 03332 return true; 03333 }
soap_transport_http::usePersistentConnection | ( | ) |
specifies that an HTTP persistent connection should be used
Definiert in Zeile 1182 der Datei class.soap_transport_http.php.
01182 { 01183 if (isset($this->outgoing_headers['Accept-Encoding'])) { 01184 return false; 01185 } 01186 $this->protocol_version = '1.1'; 01187 $this->persistentConnection = true; 01188 $this->setHeader('Connection', 'Keep-Alive'); 01189 return true; 01190 }
soap_transport_http::$authtype = '' |
Definiert in Zeile 41 der Datei class.soap_transport_http.php.
soap_transport_http::$certRequest = array() |
Definiert in Zeile 43 der Datei class.soap_transport_http.php.
soap_transport_http::$ch = false |
Definiert in Zeile 35 der Datei class.soap_transport_http.php.
soap_transport_http::$ch_options = array() |
Definiert in Zeile 36 der Datei class.soap_transport_http.php.
soap_transport_http::$digest_uri = '' |
Definiert in Zeile 19 der Datei class.soap_transport_http.php.
soap_transport_http::$digestRequest = array() |
Definiert in Zeile 42 der Datei class.soap_transport_http.php.
soap_transport_http::$encoding = '' |
Definiert in Zeile 26 der Datei class.soap_transport_http.php.
soap_transport_http::$host = '' |
Definiert in Zeile 21 der Datei class.soap_transport_http.php.
soap_transport_http::$incoming_cookies = array() |
Definiert in Zeile 29 der Datei class.soap_transport_http.php.
soap_transport_http::$incoming_headers = array() |
Definiert in Zeile 28 der Datei class.soap_transport_http.php.
soap_transport_http::$incoming_payload = '' |
Definiert in Zeile 31 der Datei class.soap_transport_http.php.
soap_transport_http::$outgoing_headers = array() |
Definiert in Zeile 27 der Datei class.soap_transport_http.php.
soap_transport_http::$outgoing_payload = '' |
Definiert in Zeile 30 der Datei class.soap_transport_http.php.
soap_transport_http::$password = '' |
Definiert in Zeile 40 der Datei class.soap_transport_http.php.
soap_transport_http::$path = '' |
Definiert in Zeile 23 der Datei class.soap_transport_http.php.
soap_transport_http::$persistentConnection = false |
Definiert in Zeile 34 der Datei class.soap_transport_http.php.
soap_transport_http::$port = '' |
Definiert in Zeile 22 der Datei class.soap_transport_http.php.
soap_transport_http::$protocol_version = '1.0' |
Definiert in Zeile 25 der Datei class.soap_transport_http.php.
soap_transport_http::$proxy = null |
Definiert in Zeile 38 der Datei class.soap_transport_http.php.
soap_transport_http::$request_method = 'POST' |
Definiert in Zeile 24 der Datei class.soap_transport_http.php.
soap_transport_http::$response_status_line |
Definiert in Zeile 32 der Datei class.soap_transport_http.php.
soap_transport_http::$scheme = '' |
Definiert in Zeile 20 der Datei class.soap_transport_http.php.
soap_transport_http::$uri = '' |
Definiert in Zeile 18 der Datei class.soap_transport_http.php.
soap_transport_http::$url = '' |
Definiert in Zeile 17 der Datei class.soap_transport_http.php.
soap_transport_http::$use_curl = false |
Definiert in Zeile 37 der Datei class.soap_transport_http.php.
soap_transport_http::$username = '' |
Definiert in Zeile 39 der Datei class.soap_transport_http.php.
soap_transport_http::$useSOAPAction = true |
Definiert in Zeile 33 der Datei class.soap_transport_http.php.
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|