[原]使用MOTO(也許是所有非Nokia吧)手機通過CMWAP進行HTTP連接

(真是有中國特色的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();

//..............後面都一樣了

發佈了35 篇原創文章 · 獲贊 0 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章