在 API 文档中它说
默认情况下,请求查找的结果在响应正文中以逐行键=值格式提供。例如,典型结果的格式可能如下:
--START:447777777777 status="ok" mcc="234" mnc="02"
operatorname="O2" isoalpha3code="GBR" END:447777777777--
所以,我向
http://api.txtnation.com/Networks/Lookup?username=user123&password=pwd123&
msisdn=447766551112
String addParam=java.net.URLEncoder.encode("username", "UTF-8")
+ "="
+ java.net.URLEncoder.encode(username, "UTF-8")
+ "&"
+ java.net.URLEncoder.encode("password", "UTF-8")
+ "="
+ java.net.URLEncoder.encode(password, "UTF-8")
+ "&"
+ java.net.URLEncoder.encode("msisdn", "UTF-8")
+ "="
+ java.net.URLEncoder.encode(msisdn, "UTF-8")
java.net.URL msisdnLookup= new java.net.URL("http://api.txtnation.com/Networks
/LookUp/?"+addParam);
java.net.HttpURLConnection mmpostback = (java.net.HttpURLConnection)
msisdnLookup.openConnection();
mmpostback.setDoOutput(true);
mmpostback.setRequestMethod("GET");
它向我显示 HTTP 响应:好的
System.out.println(mmpostback.getResponseMessage());
但以下显示我为NULL ..
status=request.getParameter("status");
mcc=request.getParameter("mcc");
mnc=request.getParameter("mnc");
我什至尝试读取参数和标题,但找不到上面的名称 - status、mcc、mnc、operatorname、isoalpha3code
如何在 jsp 中读取请求正文?请建议