JAVA 调用demo: 实例下载


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vikirequestclientDemo;
import util.HttpUtil;

/**
 *
 * @author Luojie
 */
public class HttpRequestClient {
                
	public static void main(String[] args) throws Exception {
        
            //获取key , 只需要获取一次
            String key = java.net.URLEncoder.encode("xxx", "utf-8"); //后台superadmin设置的 = xxx
            String pass = java.net.URLEncoder.encode("xxx", "utf-8"); //公司admin登录的密码 = xxx
            String url = "http://xxx.wei-fu.cn/webAPI/pe.php?pass="+pass+"&key="+key; //服务器地址
            String ret = HttpUtil.doPost(url, "");
            System.out.println(ret);
            
            //点击拨号
            String userName = "test"; //公司编号
            String passWord = ret; //通过上面过程获取
            String model = "OnClickCall";
            String exten = "8004"; //分机
            String toTel = "1380013800"; //被叫
            url = "http://xxx.wei-fu.cn/webAPI/webHttpAPI.php?model="+model+"&exten="+exten+"&toTel="+toTel+"&userName="+userName+"&passWord="+passWord; 
            ret = HttpUtil.doPost(url, "");
            System.out.println(ret);   
		
	}
    
}