Home > php教程 > PHP源码 > body text

hessian php安装配置与使用方法

WBOY
Release: 2016-06-08 17:21:42
Original
1163 people have browsed it

hessian php可以以http的方式和其他的语言交换数据了,下面我我们一起来看看hessian php安装配置与使用方法,希望对各位有帮助。

<script>ec(2);</script>

下载HessianPHP_v2.0.3.zip
下载地址:http://sourceforge.net/projects/hessianphp/
(不要使用HessianPHP-1.0.5-RC2.zip, 2006年后没有更新了,不支持php5.2以后,及最新hessian协议.
注意:需要注意服务器端发布的hessian协议版本,客户端要与之对应.)
 
使用例子在:HessianPHP_v2.0.3.zipquickstart.txt
http://localhost/mathService.php  ——–>访问该url时才在服务器端发布hessian.
http://localhost/mathClient.php  ———>客户端
其中,涉及三个文件:
Math.php

 代码如下 复制代码
class Math{
 function add($n1,$n2) {      
   return $n1+$n2;  
 }  
 function sub($n1,$n2) {      
   return $n1-$n2;  
 }  
 function mul($n1,$n2) {      
   return $n1*$n2;  
 }  
 function div($n1,$n2) {      
   return $n1/$n2;  
 }
}
==========================
mathService.php
include_once ‘Math.php’;
include_once ‘hessianphp/HessianService.php’;
$service = new HessianService(new Math());
$service->handle();
==========================
mathClient.php
include_once ‘hessianphp/HessianClient.php’;
$testurl = ‘http://localhost/yii/testdrive/mathService.php’;
$proxy = new HessianClient($testurl);
try{
   echo $proxy->div(2,5);
} catch (Exception $ex){
  // …handle error
  echo $ex->getMessage();
}

另外,在运行的时候,需要打开php的CURL扩展:C:xamppphpphp.ini
extension=php_curl.dll

ssl安全验证


修改hessianphp包中的HessianTransport.php文件中的51行$curlOptions数组,增加CURLOPT_USERPWD => “SSL验证的用户名:密码”和CURLOPT_SSL_VERIFYPEER =>FALSE,CURLOPT_SSL_VERIFYHOST=>FALSE三项。

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!