commit | author | age
|
3e083b
|
1 |
<?php |
B |
2 |
define('IN_ECS', true); |
|
3 |
require('data/config_api.php'); |
|
4 |
require('includes/cls_mysql.php'); |
|
5 |
require('includes/cls_ecshop.php'); |
|
6 |
require_once ("includes/lib_soap.php"); |
|
7 |
|
|
8 |
|
|
9 |
$server = new soap_server; |
|
10 |
//避免乱码 |
|
11 |
$server->soap_defencoding = 'UTF-8'; |
|
12 |
$server->decode_utf8 = false; |
|
13 |
$server->xml_encoding = 'UTF-8'; |
|
14 |
$server->configureWSDL('addTongji');//打开wsdl支持 |
|
15 |
/* |
|
16 |
注册需要被客户端访问的程序 |
|
17 |
类型对应值:bool->"xsd:boolean" string->"xsd:string" |
|
18 |
int->"xsd:int" float->"xsd:float" |
|
19 |
*/ |
|
20 |
$server->register( 'addTongji', //方法名 |
|
21 |
array("domain"=>"xsd:string"), //参数,默认为"xsd:string" |
|
22 |
array("ip"=>"xsd:string"), //参数,默认为"xsd:string" |
|
23 |
array("return"=>"xsd:string") );//返回值,默认为"xsd:string" |
|
24 |
//isset 检测变量是否设置 |
|
25 |
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; |
|
26 |
//service 处理客户端输入的数据 |
|
27 |
$server->service($HTTP_RAW_POST_DATA); |
|
28 |
|
|
29 |
/** |
|
30 |
* 供调用的方法 |
|
31 |
* @param $name |
|
32 |
*/ |
|
33 |
|
|
34 |
function sayHello($name) { |
|
35 |
return "Hello, {$name}!"; |
|
36 |
} |
|
37 |
|
|
38 |
function addTongji($domain,$ip) { |
|
39 |
/*global $db,$db_host,$db_user,$db_pass,$db_name,$prefix; |
|
40 |
$ecs = new ECS($db_name, $prefix); |
|
41 |
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name); |
|
42 |
list($dom,$domainname,$ext)=explode('.',$domain); |
|
43 |
$domainname .= '.'.$ext; |
|
44 |
$namemd5 = md5($domainname); |
|
45 |
$userip = $ip;*/ |
|
46 |
try { |
|
47 |
//$sql = 'INSERT INTO '. $ecs->table('userinfo') . ' (`domain_name`, `name_md5`, `addtime`, `userip`, `userpv`) VALUES ("'.$domainname.'","'.$namemd5.'",'.time().',"'.$userip.'",0) ON DUPLICATE KEY UPDATE userpv=userpv+1'; |
|
48 |
//$db->query($sql); |
|
49 |
return '1'; |
|
50 |
} catch (Exception $e) { |
|
51 |
return '0'; |
|
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
|
|
56 |
?> |