php 动态彩码辨色 接口的调用_php 调用 java 接口

php 需要开启 curl模块

/*

* HTTP 请求函数封装

*/

function http_request_cloudzone($url, $data){

//var_dump($url."test");

if(!$url){

return "";

}

$ch = curl_init ();

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); //禁用证书

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

curl_setopt ($ch, CURLOPT_HEADER, 0); //头文件信息做数据流输出

curl_setopt ($ch, CURLOPT_URL, $url);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);

curl_setopt ($ch, CURLOPT_POST, 1); //启用POST提交

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$output = curl_exec ($ch);

curl_close ($ch);

return json_decode($output, true);

}

// 请求获取登陆用户信息

// http://localhost/wiki/test.php?userId=71D68F2D8C780B6D785F392ED024B701359CBF3CCBDB25D5&appId=CNGDLG0200000000000&interfacesURL=http://192.168.102.114/cloudzone/

// {\"appId\":\"CNGDLG0200000000000\", \"userId\":\"71D68F2D8C780B6D785F392ED024B701359CBF3CCBDB25D5\"}"

// rsp { ["appInfo"]=> array(3) { ["appId"]=> string(19) "CNGDLG0200000000000" ["webUrl"]=> string(36) "http://192.168.113.127/wiki/test.php" ["webUrlWan"]=> string(36) "http://192.168.113.127/wiki/test.php" } ["serverResult"]=> array(2) { ["resultCode"]=> int(0) ["resultMessage"]=> string(6) "成功" } ["teacherClassList"]=> array(0) { } ["token"]=> string(112) "183cfa43aa68d5b3c393753e173e914626b859e14ee40df68ba289324d8706d7679be1e96c2a3a2e333d6972bd521b9b4fb45e0d6dd1e2ee" ["userInfo"]=> array(11) { ["encryptedUserId"]=> string(48) "71D68F2D8C780B6D785F392ED024B701359CBF3CCBDB25D5" ["gender"]=> string(0) "" ["lastModifyTime"]=> string(19) "2016-02-29 09:49:02" ["loginName"]=> string(4) "test" ["schoolId"]=> string(19) "CNGDLG0600000000001" ["schoolName"]=> string(6) "学校" ["schoolSection"]=> string(14) "PRIMARY_SCHOOL" ["staticPassword"]=> string(16) "a83a68c6e9967731" ["userAccount"]=> string(19) "CNGDLG0600000000025" ["userName"]=> string(4) "test" ["userType"]=> string(1) "2" } ["xmppInfo"]=> array(3) { ["xmppHeartbeatPort"]=> string(4) "9090" ["xmppIp"]=> string(22) "http://192.168.102.114" ["xmppServer"]=> string(34) "http://http://192.168.102.114:9090" } }

// 新增TW教育云鉴权同步登陆入口方法

function dotwauthentication(){

if(!$this->get['2'] || !$this->get['3'] || !$this->get['4']){

$this->header("");

}

$url = $this->get['2'];

$data['userId'] = $this->get['3'];

$data['appId'] = $this->get['4'];

$data_json = json_encode($data);

$url = $url."/ClientApi/getAuthenticationInfo";

$output_json = $this->http_request_cloudzone($url, $data_json);

if($output_json){

$rsp_code = $output_json["serverResult"]["resultCode"];

if($rsp_code == 0){

// 请求成功

$twuserid= $output_json["userInfo"]["userAccount"];

$twuserpwd= $output_json["userInfo"]["staticPassword"];

$twusername= $output_json["userInfo"]["userName"];

$des_java_c = new DES_JAVA();

$twuserpwd= $des_java_c->decrypt($twuserpwd);

$this->dotwsysuser($twusername, $twuserid, $twuserpwd);

}else{

//请求失败

$this->header('');

}

}else{

//请求失败

$this->header('');

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值