|
本帖最后由 骑着毛驴追火箭 于 2013-2-3 14:43 编辑
PHP复制代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//密钥
function get_encryt_key (){
return "64faa1e027c38d257f24889c070f45f8";
}
//获取通信密码
function get_safty_key (){
return "b72533da894024113d642496bfb42f83";
}
if(!function_exists("call_web_service")){
/**
* 调用webservice,方法集
* @param unknown_type $location webservice的url
* @param unknown_type $method 方法名
* @param unknown_type $params 传递给该方法的参数,可能包含通信密码
*/
function call_web_service ($location,$method,$params){
$soap_client=new SoapClient (null,array("location"=>$location,"uri"=>$location));
return $soap_client->__soapCall ($method,$params);
}
}
if(!function_exists("get_web_service_class")){
/**
* 获得以类作为webservice的一个远程对象
*/
function get_web_service_class ($url){
$soap_client=new SoapClient (null,array("location"=>$url,"uri"=>$url));
return $soap_client;
}
}
if(!function_exists("get_touch_encrypt_key")){
/**
* 获得通信密码
*/
function get_touch_encrypt_key (){
$ci=& get_instance ();
$ci->load->library("syscrypt",array(get_encryt_key ()));
return $ci->syscrypt->php_encrypt(get_safty_key ());
}
}
/**
* 建立若干个方法的webservice
*/
if(!function_exists("create_web_service")){
function create_web_service ($uri,$methods=array()){
$soap_server=new SoapServer (null,array("uri"=>$uri));
foreach ($methods as $key=>$val) {
if(function_exists($val)){
$soap_server->addFunction($val);
}else{
show_error ("the funciton you want to created in the web service can not find!");
}
}
$soap_server->handle();
}
}
/**
* 建立若干个方法的webservice
*/
if(!function_exists("create_web_service_class")){
function create_web_service_class ($uri,$c){
$soap_server=new SoapServer (null,array("uri"=>$uri));
if(class_exists($c)){
$soap_server->setClass($c);
}else{
show_error ("the class you want to created in the web service can not find!");
}
$soap_server->handle();
}
}
/**
$soap_client=new SoapClient(null,array("location"=>"file:///C:\Users\DEVINS~1.ING\AppData\Local\Temp\%W@GJ$ACOF(TYDYECOKVDYB.pnghttp://192.168.1.110:9898/index.php/share/service",
"uri"=>"file:///C:\Users\DEVINS~1.ING\AppData\Local\Temp\%W@GJ$ACOF(TYDYECOKVDYB.pnghttp://192.168.1.110:9898/index.php/share/service"));
$syscrypt=new SysCrypt("64faa1e027c38d257f24889c070f45f8");
$key=$syscrypt->php_encrypt("b72533da894024113d642496bfb42f83"); //通信密码
$params1 = array($key,"xxx");
$reversed = $soap_client->__soapCall('get_frequence',$params1);
**/
复制代码
网上找了个webservice_helper .php 不知这个webservice_helper怎么用
求助大吓,非常感谢 ,本人对php不熟悉,求解
|
|