参数 类型 默认 说明
subject string 必填 可以是传真号码,也可以是传真接收号码列表。例:
02151010001或
ADDRESS-LIST=list.txt
如果是列表
precision string photo_low 只有能三个选择
1.photo_low  正常精度(系统默认)
2.photo_normal  高精度
3.photo_high  图片精度
msgid string 查询传真任务的关键字
格式:interface-{userid}-xxxxxxx
必须以interface开始.加上账号名,后面跟着随机字符串,一定要确保msgid唯一。
body string 要发送的传真正文
... file 要发送的传真文……
... file 接收号码列表文件。
       

我们的传真发送采用存储转发模式,非即时性.所以,传真任务提交后,并非马上出结果.必须调用"查询传真任务"进行查询才能知道发送的状态.
result代码 描述
-1 传真提交失败
0 传真提交成功
-3 身份认证失败


	static String format = "xml";
	static String userid = "demo@gfax.cn";//账号必须加上@gfax.cn,否则失败
	static String pass = "mypassword";
	static String deskey = "mydeskey";
	//发送传真
	public static void SendFax() {
		String msgid = "interface-"+userid+"-"+System.currentTimeMillis();
		String posturl = "http://api.gfax.cn:8088/sendfax/" + format;
		AllcomUtil allcom = new AllcomUtil(userid,pass,AllcomUtil.MD5);

		Map<String, String> datamap = new Hashtable<String, String>();
		datamap.put("subject", "99999999");
		datamap.put("precision", "photo_low");
		//datamap.put("subject", "ADDRESS-LIST=num.txt");
		//datamap.put("subject", "99999999;99999997;99999996");
		//datamap.put("subject", "99999999,8016;02151010001/陈经理/邀请函");
		
		datamap.put("body", "test传真");
		datamap.put("msgid", msgid);

		List<String> filelist = new ArrayList<String>();
		filelist.add("d:\\传真文件1.doc");
		filelist.add("d:\\传真文件2.doc");
		//filelist.add("d:\\num.txt");
		
		String result = allcom.sendFax(posturl, datamap, filelist);
		System.out.println(result);
	}
	
require("allcomutil.php");
$userid = "jun@gfax.cn"; //账号必须加上@gfax.cn,否则失败
$pass = "mxjunolkd";
$allcom = new allcom($userid,$pass);

$msgid = "interface-".$userid."-".time(); 
$faxto = "02151010001";
$url = "http://api.gfax.cn:8088/sendfax/xml";


$postdata = array( 
	'subject' => $faxto, 
	'precision' => "photo_low", 
	'msgid' => $msgid, 
); 
$files['fax1'] = "d:\\fax1.doc";
$files['fax2'] = "d:\\fax2.doc";

$result = $allcom->sendFax($url,$postdata, $files){

echo $result;
	

		string userid = "jun@gfax.cn";//账号必须加上@gfax.cn,否则失败
		string pass = "mxjunolkd";
		string deskey = "ttttaaaa";

		public void sendfax1(){
			AllcomUtil allcom = new AllcomUtil(userid,pass,1,deskey);
			string msgid = "interface-"+userid+"-"+allcom.toUTP(DateTime.Now);  

			NameValueCollection nvcdata = new NameValueCollection();
			nvcdata.Add("subject","02151010001");
			nvcdata.Add("precision","photo_low");
			nvcdata.Add("msgid",msgid);

			NameValueCollection nvcfile = new NameValueCollection();
			nvcfile.Add("file1","d:\\fax1.doc");
			nvcfile.Add("file2","d:\\fax2.doc");
			
			string result = allcom.sendFax("http://api.gfax.cn:8088/sendfax/xml",nvcdata,nvcfile);
			Console.WriteLine(result);
		}

		public void sendfax2(){
			
			AllcomUtil allcom = new AllcomUtil(userid,pass,1,deskey);
			string msgid = "interface-"+userid+"-"+allcom.toUTP(DateTime.Now);  

			NameValueCollection nvcdata = new NameValueCollection();
			nvcdata.Add("subject","ADDRESS-LIST=num.txt");
			nvcdata.Add("msgid",msgid);

			NameValueCollection nvcfile = new NameValueCollection();
			nvcfile.Add("file1","d:\\fax1.doc");
			nvcfile.Add("file2","d:\\fax2.doc");
			nvcfile.Add("file3","d:\\num.txt");
			
			string result = allcom.sendFax("http://api.gfax.cn:8088/sendfax/xml",nvcdata,nvcfile);
			Console.WriteLine(result);
		}

	
服务器返回示例1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gfaxroot>
    <result>0</result>
    <msgid>interface-demo@gfax.cn-1329037244400</msgid>
</gfaxroot>
服务器返回示例2
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gfaxroot>
    <result>-3</result>
    <msgid>interface-demo@gfax.cn-1329037244400</msgid>
</gfaxroot>