⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nusoap.php

📁 学校网站源码http://您的网址/admin/admin_login.asp 默认登录用户:admin 默认登录密码:admin
💻 PHP
📖 第 1 页 / 共 5 页
字号:
		return $buffer;
	}

	function addcomplextype( $name, $typeClass = "complexType", $phpType = "array", $compositor = "", $restrictionBase = "", $elements = array( ), $attrs = array( ), $arrayType = "" )
	{
		$this->complexTypes[$name] = array(
			"name" => $name,
			"typeClass" => $typeClass,
			"phpType" => $phpType,
			"compositor" => $compositor,
			"restrictionBase" => $restrictionBase,
			"elements" => $elements,
			"attrs" => $attrs,
			"arrayType" => $arrayType
		);
		$this->xdebug( "addComplexType {$name}: ".$this->vardump( $this->complexTypes[$name] ) );
	}

	function addsimpletype( $name, $restrictionBase = "", $typeClass = "simpleType", $phpType = "scalar" )
	{
		$this->simpleTypes[$name] = array(
			"name" => $name,
			"typeClass" => $typeClass,
			"phpType" => $phpType,
			"type" => $restrictionBase
		);
		$this->xdebug( "addSimpleType {$name}: ".$this->vardump( $this->simpleTypes[$name] ) );
	}

}

class soapval extends nusoap_base
{

	var $title = "NuSOAP";
	var $version = "0.6.7";
	var $revision = "\$Revision: 1.75 \$";
	var $error_str = false;
	var $debug_str = "";
	var $charencoding = true;
	var $XMLSchemaVersion = "http://www.w3.org/2001/XMLSchema";
	var $soap_defencoding = "ISO-8859-1";
	var $namespaces = array
	(
		"SOAP-ENV" => "http://schemas.xmlsoap.org/soap/envelope/",
		"xsd" => "http://www.w3.org/2001/XMLSchema",
		"xsi" => "http://www.w3.org/2001/XMLSchema-instance",
		"SOAP-ENC" => "http://schemas.xmlsoap.org/soap/encoding/",
		"si" => "http://soapinterop.org/xsd"
	);
	var $usedNamespaces = array( );
	var $typemap = array
	(
		"http://www.w3.org/2001/XMLSchema" => array
		(
			"string" => "string",
			"boolean" => "boolean",
			"float" => "double",
			"double" => "double",
			"decimal" => "double",
			"duration" => "",
			"dateTime" => "string",
			"time" => "string",
			"date" => "string",
			"gYearMonth" => "",
			"gYear" => "",
			"gMonthDay" => "",
			"gDay" => "",
			"gMonth" => "",
			"hexBinary" => "string",
			"base64Binary" => "string",
			"normalizedString" => "string",
			"token" => "string",
			"language" => "",
			"NMTOKEN" => "",
			"NMTOKENS" => "",
			"Name" => "",
			"NCName" => "",
			"ID" => "",
			"IDREF" => "",
			"IDREFS" => "",
			"ENTITY" => "",
			"ENTITIES" => "",
			"integer" => "integer",
			"nonPositiveInteger" => "integer",
			"negativeInteger" => "integer",
			"long" => "integer",
			"int" => "integer",
			"short" => "integer",
			"byte" => "integer",
			"nonNegativeInteger" => "integer",
			"unsignedLong" => "",
			"unsignedInt" => "",
			"unsignedShort" => "",
			"unsignedByte" => "",
			"positiveInteger" => ""
		),
		"http://www.w3.org/1999/XMLSchema" => array
		(
			"i4" => "",
			"int" => "integer",
			"boolean" => "boolean",
			"string" => "string",
			"double" => "double",
			"float" => "double",
			"dateTime" => "string",
			"timeInstant" => "string",
			"base64Binary" => "string",
			"base64" => "string",
			"ur-type" => "array"
		),
		"http://soapinterop.org/xsd" => array
		(
			"SOAPStruct" => "struct"
		),
		"http://schemas.xmlsoap.org/soap/encoding/" => array
		(
			"base64" => "string",
			"array" => "array",
			"Array" => "array"
		),
		"http://xml.apache.org/xml-soap" => array
		(
			0 => "Map"
		)
	);
	var $xmlEntities = array
	(
		"quot" => "\"",
		"amp" => "&",
		"lt" => "<",
		"gt" => ">",
		"apos" => "'"
	);

	function soapval( $name = "soapval", $type = false, $value = -1, $element_ns = false, $type_ns = false, $attributes = false )
	{
		$this->name = $name;
		$this->value = $value;
		$this->type = $type;
		$this->element_ns = $element_ns;
		$this->type_ns = $type_ns;
		$this->attributes = $attributes;
	}

	function serialize( $use = "encoded" )
	{
		return $this->serialize_val( $this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use );
	}

	function decode( )
	{
		return $this->value;
	}

}

class soap_transport_http extends nusoap_base
{

	var $title = "NuSOAP";
	var $version = "0.6.7";
	var $revision = "\$Revision: 1.75 \$";
	var $error_str = false;
	var $debug_str = "";
	var $charencoding = true;
	var $XMLSchemaVersion = "http://www.w3.org/2001/XMLSchema";
	var $soap_defencoding = "ISO-8859-1";
	var $namespaces = array
	(
		"SOAP-ENV" => "http://schemas.xmlsoap.org/soap/envelope/",
		"xsd" => "http://www.w3.org/2001/XMLSchema",
		"xsi" => "http://www.w3.org/2001/XMLSchema-instance",
		"SOAP-ENC" => "http://schemas.xmlsoap.org/soap/encoding/",
		"si" => "http://soapinterop.org/xsd"
	);
	var $usedNamespaces = array( );
	var $typemap = array
	(
		"http://www.w3.org/2001/XMLSchema" => array
		(
			"string" => "string",
			"boolean" => "boolean",
			"float" => "double",
			"double" => "double",
			"decimal" => "double",
			"duration" => "",
			"dateTime" => "string",
			"time" => "string",
			"date" => "string",
			"gYearMonth" => "",
			"gYear" => "",
			"gMonthDay" => "",
			"gDay" => "",
			"gMonth" => "",
			"hexBinary" => "string",
			"base64Binary" => "string",
			"normalizedString" => "string",
			"token" => "string",
			"language" => "",
			"NMTOKEN" => "",
			"NMTOKENS" => "",
			"Name" => "",
			"NCName" => "",
			"ID" => "",
			"IDREF" => "",
			"IDREFS" => "",
			"ENTITY" => "",
			"ENTITIES" => "",
			"integer" => "integer",
			"nonPositiveInteger" => "integer",
			"negativeInteger" => "integer",
			"long" => "integer",
			"int" => "integer",
			"short" => "integer",
			"byte" => "integer",
			"nonNegativeInteger" => "integer",
			"unsignedLong" => "",
			"unsignedInt" => "",
			"unsignedShort" => "",
			"unsignedByte" => "",
			"positiveInteger" => ""
		),
		"http://www.w3.org/1999/XMLSchema" => array
		(
			"i4" => "",
			"int" => "integer",
			"boolean" => "boolean",
			"string" => "string",
			"double" => "double",
			"float" => "double",
			"dateTime" => "string",
			"timeInstant" => "string",
			"base64Binary" => "string",
			"base64" => "string",
			"ur-type" => "array"
		),
		"http://soapinterop.org/xsd" => array
		(
			"SOAPStruct" => "struct"
		),
		"http://schemas.xmlsoap.org/soap/encoding/" => array
		(
			"base64" => "string",
			"array" => "array",
			"Array" => "array"
		),
		"http://xml.apache.org/xml-soap" => array
		(
			0 => "Map"
		)
	);
	var $xmlEntities = array
	(
		"quot" => "\"",
		"amp" => "&",
		"lt" => "<",
		"gt" => ">",
		"apos" => "'"
	);
	var $url = "";
	var $uri = "";
	var $scheme = "";
	var $host = "";
	var $port = "";
	var $path = "";
	var $request_method = "POST";
	var $protocol_version = "1.0";
	var $encoding = "";
	var $outgoing_headers = array( );
	var $incoming_headers = array( );
	var $outgoing_payload = "";
	var $incoming_payload = "";
	var $useSOAPAction = true;
	var $persistentConnection = false;
	var $ch = false;
	var $username;
	var $password;

	function soap_transport_http( $url )
	{
		$this->url = $url;
		$u = parse_url( $url );
		foreach ( $u as $k => $v )
		{
			$this->debug( "{$k} = {$v}" );
			$this->$k = $v;
		}
		if ( isset( $u['query'] ) && $u['query'] != "" )
		{
			$this->path .= "?".$u['query'];
		}
		if ( !isset( $u['port'] ) )
		{
			if ( $u['scheme'] == "https" )
			{
				$this->port = 443;
			}
			else
			{
				$this->port = 80;
			}
		}
		$this->uri = $this->path;
		ereg( "\\\$Revisio"."n: ([^ ]+)", $this->revision, $rev );
		$this->outgoing_headers['User-Agent'] = $this->title."/".$this->version." (".$rev[1].")";
		if ( !isset( $u['port'] ) )
		{
			$this->outgoing_headers['Host'] = $this->host;
		}
		else
		{
			$this->outgoing_headers['Host'] = $this->host.":".$this->port;
		}
		if ( isset( $u['user'] ) && $u['user'] != "" )
		{
			$this->setcredentials( $u['user'], isset( $u['pass'] ) ? $u['pass'] : "" );
		}
	}

	function connect( $connection_timeout = 0, $response_timeout = 30 )
	{
		$this->debug( "connect connection_timeout {$connection_timeout}, response_timeout {$response_timeout}, scheme {$this->scheme}, host {$this->host}, port {$this->port}" );
		if ( $this->scheme == "http" || $this->scheme == "ssl" )
		{
			if ( $this->persistentConnection && isset( $this->fp ) && is_resource( $this->fp ) )
			{
				if ( !feof( $this->fp ) )
				{
					$this->debug( "Re-use persistent connection" );
					return true;
				}
				fclose( $this->fp );
				$this->debug( "Closed persistent connection at EOF" );
			}
			if ( $this->scheme == "ssl" )
			{
				$host = "ssl://".$this->host;
			}
			else
			{
				$host = $this->host;
			}
			$this->debug( "calling fsockopen with host ".$host );
			if ( 0 < $connection_timeout )
			{
				$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout );
			}
			else
			{
				$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str );
			}
			if ( !$this->fp )
			{
				$msg = "Couldn't open socket connection to server ".$this->url;
				if ( $this->errno )
				{
					$msg .= ", Error (".$this->errno."): ".$this->error_str;
				}
				else
				{
					$msg .= " prior to connect().  This is often a problem looking up the host name.";
				}
				$this->debug( $msg );
				$this->seterror( $msg );
				return false;
			}
			socket_set_timeout( $this->fp, $response_timeout );
			$this->debug( "socket connected" );
			return true;
		}
		else if ( $this->scheme == "https" )
		{
			if ( !extension_loaded( "curl" ) )
			{
				$this->seterror( "CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS" );
				return false;
			}
			$this->debug( "connect using https" );
			$this->ch = curl_init( );
			$hostURL = $this->port != "" ? "https://{$this->host}:{$this->port}" : "https://{$this->host}";
			$hostURL .= $this->path;
			curl_setopt( $this->ch, CURLOPT_URL, $hostURL );
			curl_setopt( $this->ch, CURLOPT_HEADER, 1 );
			curl_setopt( $this->ch, CURLOPT_RETURNTRANSFER, 1 );
			if ( $this->persistentConnection )
			{
				$this->persistentConnection = false;
				$this->outgoing_headers['Connection'] = "close";
			}
			if ( $connection_timeout != 0 )
			{
				curl_setopt( $this->ch, CURLOPT_TIMEOUT, $connection_timeout );
			}
			curl_setopt( $this->ch, CURLOPT_SSL_VERIFYPEER, 0 );
			curl_setopt( $this->ch, CURLOPT_SSL_VERIFYHOST, 0 );
			$this->debug( "cURL connection set up" );
			return true;
		}
		else
		{
			$this->seterror( "Unknown scheme ".$this->scheme );
			$this->debug( "Unknown scheme ".$this->scheme );
			return false;
		}
	}

	function send( $data, $timeout = 0, $response_timeout = 30 )
	{
		$this->debug( "entered send() with data of length: ".strlen( $data ) );
		$this->tryagain = true;
		$tries = 0;
		while ( $this->tryagain )
		{
			$this->tryagain = false;
			if ( $tries++ < 2 )
			{
				if ( !$this->connect( $timeout, $response_timeout ) )
				{
					return false;
				}
				if ( !$this->sendrequest( $data ) )
				{
					return false;
				}
				$respdata = $this->getresponse( );
			}
			else
			{
				$this->seterror( "Too many tries to get an OK response" );
			}
		}
		$this->debug( "end of send()" );
		return $respdata;
	}

	function sendhttps( $data, $timeout = 0, $response_timeout = 30 )
	{
		return $this->send( $data, $timeout, $response_timeout );
	}

	function setcredentials( $username, $password, $authtype = "basic", $digestRequest = array( ) )
	{
		global $_SERVER;
		$this->debug( "Set credentials for authtype {$authtype}" );
		if ( $authtype == "basic" )
		{
			$this->outgoing_headers['Authorization'] = "Basic ".base64_encode( $username.":".$password );
		}
		else if ( $authtype == "digest" )
		{
			if ( isset( $digestRequest['nonce'] ) )
			{
				$digestRequest['nc'] = isset( $digestRequest['nc'] ) ? $digestRequest['nc']++ : 1;
				$A1 = $username.":".$digestRequest['realm'].":".$password;
				$HA1 = md5( $A1 );
				$A2 = "POST:".$this->uri;
				$HA2 = md5( $A2 );
				$unhashedDigest = "";
				$nonce = isset( $digestRequest['nonce'] ) ? $digestRequest['nonce'] : "";
				$cnonce = $nonce;
				if ( $digestRequest['qop'] != "" )
				{
					$unhashedDigest = $HA1.":".$nonce.":".sprintf( "%08d", $digestRequest['nc'] ).":".$cnonce.":".$digestRequest['qop'].":".$HA2;
				}
				else
				{
					$unhashedDigest = $HA1.":".$nonce.":".$HA2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -