Home >Backend Development >PHP Tutorial > 首信易支付,话费充值接口解决方法
首信易支付,话费充值接口
采用数据加密的形式:md5+des
<br /> package com.test.moltest;<br /> <br /> import net.sf.json.JSONObject;<br /> <br /> import com.huonet.util.DESTools;<br /> import com.huonet.util.UserJsonUtil;<br /> <br /> public class MobileRecharg { <br /> public static void main(String[] argv) throws Exception { <br /> //调用充值接口<br /> String application_value = "recharge";<br /> String account = "payease";<br /> String mobile = "13581570818";<br /> String orderid = "201305133127";<br /> String amount = "100";<br /> JSONObject jobj = new JSONObject();<br /> jobj.accumulate("application_value", application_value);<br /> jobj.accumulate("account", account);<br /> jobj.accumulate("mobile", mobile);<br /> jobj.accumulate("amount", amount);<br /> jobj.accumulate("orderid", orderid);<br /> String s = java.net.URLEncoder.encode(UserJsonUtil.encryptJsonUser(jobj));<br /> String res= "http://www1.beijing.com.cn/user/api/mobile_test.jsp?s="+s;<br /> System.out.println( "res=="+res);<br /> //调用结束<br /> <br /> //处理返回结果<br /> <br /> //res = "CLp5Zjwtq9waj0Q6QNj6TArNHqMOwuJV/FRlHdmk4UFxExX0bEeH+pbi9guWDjTju/XchsQrIfJleZvQGw8Efb4JxzOosnXTstG00gxVzROVinl6o30HUA==";<br /> System.out.println(UserJsonUtil.decryptJsonUser1(res.trim()));<br /> s = DESTools.decrypt("testtest", s);//解密1<br /> jobj = JSONObject.fromObject(s);<br /> System.out.println(jobj);<br /> <br /> }<br /> <br /> }<br />