[原]使用MOTO(也许是所有非Nokia吧)手机通过CMWAP进行HTTP连接

类别:Java 点击:0 评论:0 推荐:

(真是有中国特色的J2ME编程啊……-_-!)

/**
* sample code of http connecting via CMWAP
* @author clapton_xpAThotmailDOTcom
* assume that you gonna connect to http://www.yourdomain.com/yourdir/your.file
*/

String CMCC_PROXY="http://10.0.0.172:80/"; //这个是中国移动的代理

HttpConnection c = null;
c = (HttpConnection) Connector.open(CMCC_PROXY+"yourdir/your.file");
c.setRequestProperty("X-Online-Host", "www.yourdomain.com");  //这个是关键所在

// deal with connection
is = c.openInputStream();

//..............后面都一样了

本文地址:http://com.8s8s.com/it/it16230.htm