search
Homephp教程php手册重新封装zend_soap实现http连接安全认证的php代码
重新封装zend_soap实现http连接安全认证的php代码Jun 13, 2016 pm 12:11 PM
classhttpphpsoapzendcodecopysafety certificateaccomplishencapsulationofconnect

复制代码 代码如下:


class MyFramework_Soap_server extends Zend_Soap_Server {
protected $_login = '';
protected $_password = '';
public function __construct($wsdl = null, array $options = null) {
parent::__construct($wsdl,$options);
if(isset($options['login'])){
$this->_login=$options['login'];
$this->_password=$options['password'];
$this->_authenticate();
}
}
private function _authenticate(){
$this->setAuthenticate($this->_login,$this->_password);
}
public function setHttpLogin($login){
$this->_login=$login;
}
public function setHttpPassword($password){
$this->_password=$password;
if(isset($this->_login)){
$this->_authenticate();
}
}
public function setAuthenticate($login,$password){
if ($_SERVER['PHP_AUTH_USER']!=$login || $_SERVER['PHP_AUTH_PW']!=$password) {
header('WWW-Authenticate: Basic realm="MyFramework Realm"');
header('HTTP/1.0 401 Unauthorized');
echo "You must enter a valid login ID and password to access this resource.\n";
exit;
}
}
}
?>


复制代码 代码如下:


class Soap_server_test {
public $view = '';
public $params = '';
public $requestObj = '';
public $dbObj = '';
function __construct() {
$this->view = $GLOBALS['view'];
$this->params = $GLOBALS['params'];
$this->requestObj = $GLOBALS['requestObj'];
$this->dbObj = $GLOBALS['dbObj'];
}
function indexAction(){
if(isset($_GET['wsdl'])) {
$autodiscover = new MyFramework_Soap_AutoDiscover();
$autodiscover->setClass('Model_Service_SoapClassSetTest');
$autodiscover->handle();
exit;
} else {
//$options= array('encoding' => 'UTF-8','login'=>'tangjian','password'=>'123456');
$options= array('encoding' => 'UTF-8');
$soap = new MyFramework_Soap_Server("http://tj.MyFramework.com/default/soap_server_test/index?wsdl",$options);
$soap->setHttpLogin('tangjian');
$soap->setHttpPassword('123456');
$soap->setClass('Model_Service_SoapClassSetTest');
$soap->handle();
exit;
}
}
function clientAction() {
//$options= array('encoding' => 'UTF-8','login'=>'tangjian','password'=>'123456',
// 'compression' =>SOAP_COMPRESSION_GZIP);
$options= array('encoding' => 'UTF-8',
'compression' =>SOAP_COMPRESSION_GZIP);
$client = new MyFramework_Soap_Client('http://tj.MyFramework.com/default/soap_server_test/index?wsdl',$options);
$client->setHttpLogin('tangjian');
$client->setHttpPassword('123456');
$result=$client->getPass('tang',"man");
print_r($result);
}
}
?>

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
集邦咨询:英伟达 Blackwell 平台产品带动台积电今年 CoWoS 产能提高 150%集邦咨询:英伟达 Blackwell 平台产品带动台积电今年 CoWoS 产能提高 150%Apr 17, 2024 pm 08:00 PM

本站4月17日消息,集邦咨询(TrendForce)近日发布报告,认为英伟达Blackwell新平台产品需求看涨,预估带动台积电2024年CoWoS封装总产能提升逾150%。英伟达Blackwell新平台产品包括B系列的GPU,以及整合英伟达自家GraceArmCPU的GB200加速卡等。集邦咨询确认为供应链当前非常看好GB200,预估2025年出货量有望超过百万片,在英伟达高端GPU中的占比达到40-50%。在英伟达计划下半年交付GB200以及B100等产品,但上游晶圆封装方面须进一步采用更复

AMD “Strix Halo” FP11 封装尺寸曝光:和英特尔 LGA1700 相当,比 Phoenix 大 60%AMD “Strix Halo” FP11 封装尺寸曝光:和英特尔 LGA1700 相当,比 Phoenix 大 60%Jul 18, 2024 am 02:04 AM

本站7月9日消息,AMDZen5架构“Strix”系列处理器会有两种封装方案,其中较小的StrixPoint将采用FP8封装,而StrixHalo将会采用FP11封装。图源:videocardz消息源@Olrak29_最新曝料称StrixHalo的FP11封装尺寸为37.5mm*45mm(1687平方毫米),和英特尔AlderLake、RaptorLakeCPU的LGA-1700封装尺寸相同。AMD最新的PhoenixAPU采用FP8封装方案,尺寸为25*40mm,这意味着StrixHalo的F

PHP中的封装技术及应用PHP中的封装技术及应用Oct 12, 2023 pm 01:43 PM

PHP中的封装技术及应用封装是面向对象编程中的一个重要概念,它指的是将数据和对数据的操作封装在一起,以便提供对外部程序的统一访问接口。在PHP中,封装可以通过访问控制修饰符和类的定义来实现。本文将介绍PHP中的封装技术及其应用场景,并提供一些具体的代码示例。一、封装的访问控制修饰符在PHP中,封装主要通过访问控制修饰符来实现。PHP提供了三个访问控制修饰符,

Vue中Axios封装及其常用方法介绍Vue中Axios封装及其常用方法介绍Jun 09, 2023 pm 04:13 PM

Vue中Axios封装及其常用方法介绍Axios是一款基于Promise实现的HTTP库,它的优点在于具有良好的可读性、易用性以及可扩展性。Vue作为一款流行的前端框架,也对Axios提供了全面支持。本文将介绍如何在Vue中进行Axios封装,并且介绍Axios常用的一些方法。一、Axios封装在开发过程中,我们常常需要对Axios进行一些自定义的封装,例如

C++ 函数如何通过封装代码来提高 GUI 开发的效率?C++ 函数如何通过封装代码来提高 GUI 开发的效率?Apr 25, 2024 pm 12:27 PM

通过封装代码,C++函数可以提高GUI开发效率:代码封装:函数将代码分组到独立单元,使代码易于理解和维护。可重用性:函数可创建通用功能供应用程序中重复使用,减少重复编写和错误。简洁代码:封装代码使主逻辑简洁,便于阅读和调试。

PHP实现框架:Zend Framework入门教程PHP实现框架:Zend Framework入门教程Jun 19, 2023 am 08:09 AM

PHP实现框架:ZendFramework入门教程ZendFramework是PHP开发的一种开源网站框架,目前由ZendTechnologies维护,ZendFramework采用了MVC设计模式,提供了一系列可重用的代码库,服务于实现Web2.0应用程序和Web服务。ZendFramework深受PHP开发者的欢迎和推崇,拥有广泛

如何在Go语言中实现封装和继承如何在Go语言中实现封装和继承Jul 23, 2023 pm 08:17 PM

如何在Go语言中实现封装和继承封装和继承是面向对象编程中的两个重要概念,它们可以使代码更加模块化和可维护,同时也为代码的复用提供了便利。本文将介绍在Go语言中如何实现封装和继承,并提供相应的代码示例。封装封装是将数据和功能进行封装,隐藏实现的细节,只暴露必要的接口给外部使用。在Go语言中,封装是通过导出和非导出标识符来实现的。首字母大写的标识符可以被其他包访

如何解决Python的代码的可扩展性差错误?如何解决Python的代码的可扩展性差错误?Jun 25, 2023 am 09:51 AM

Python作为一门高级编程语言,被广泛应用于数据分析、机器学习、Web开发等领域。然而,随着代码规模不断扩大,Python程序的可扩展性问题也逐渐显现出来。可扩展性差错误是指Python程序在某些情况下不能很好地适应需求变化,无法对大规模数据进行处理,导致程序运行效果不佳。太多的依赖、糟糕的代码结构、缺乏文档等都是Python程序可扩展性差错误的罪魁祸首。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.