Since China Mobile launched the Internet tariff page reminder, many of the problems caused by the failure to connect to the server in the connection to the j2's network. That is to say, after the network is enabled in the agent program of the agent in the agent program, in some regions, the mobile gateway will cut down our request and return a notification page for the fee, in this way, our server will not receive our request, resulting in an error in program connection failure.
Therefore, when processing network connections, we need to add processing for the mobile charges page. We can check the returned response header after sending network requests, if we detect that the returned Content-Type is text/vnd. WAP. WML, We can discard this response and initiate a new request to solve the tariff page problem, or we can extract the request address in the tariff page and send a request again.
The Code is as follows:
Httpconn = (httpconnection) connector. Open (URL, permissions, true );
String S = httpconn. getheaderfield ("Content-Type ");
If (S. Equals ("text/vnd. WAP. WML ")){
// Initiate a new request
Httpconn = (httpconnection) connector. Open (URL, permissions, true );
}
If the type to be returned by the program is the WAP page, we can perform keyword parsing on the content of the WAP page to determine whether the page is returned by the server or the pay-as-you-go reminder page is sent by mobile.
From: http://www.j2medev.com/bbs/dispbbs.asp? Boardid = 54 & id = 30599
Qingkai IT Training Base-Seo in Qingdao Development Zone