RFID扫描APP--source4
来源:互联网 发布:java int除法向上取整 编辑:程序博客网 时间:2024/06/02 04:13
第四部分
4. HttpSend.java
public class Httpsend { private static final String TAG = "Httpsend"; public static final String RESULT = "flag"; public static final String FAIL = "fail"; public static final String SUCCESS = "success"; public boolean send(String urlstr, String param) { String result = ""; HttpURLConnection connection = null; BufferedReader in = null; PrintWriter out = null; try { URL url = new URL(urlstr); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); connection.setInstanceFollowRedirects(true); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.connect(); out = new PrintWriter(connection.getOutputStream()); out.print(param); out.flush(); in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String s = ""; while((s = in.readLine()) != null) { result += s; } } catch (IOException e) { Log.i(TAG, "connect error"); } finally { try { if(out != null) { out.close(); } if (in != null) { in.close(); } } catch (IOException e) { Log.i(TAG, "close error"); } } Log.i(TAG, result); try { JSONObject json = new JSONObject(result); String res = (String)json.get(RESULT); if(res.equals(SUCCESS)) { return true; } }catch(JSONException e) { Log.i(TAG, "to json error"); } return false; }}
0 0
- RFID扫描APP--source4
- RFID扫描APP Android
- RFID扫描APP--source1
- RFID扫描APP--source2
- RFID扫描APP--source3
- RFID扫描APP--source5
- RFID+二维码扫描
- 扫描二维码下载app
- APP安全扫描网站
- RFID
- RFID
- RFID
- RFID
- RFID
- RFID
- RFID
- App 扫描二维码登陆网站
- app生成二维码,扫描二维码
- PBOC3.0 SM2 算法各种证书、数字签名的验证
- SurfaceView
- iOS开发--Block容易造成循环引用
- dom4j之xpath
- 苹果官方电池保护壳 让iPhone 6怀孕一只4S
- RFID扫描APP--source4
- Linux 下的Makefile(二)
- Codeforces 424C Magic Formulas
- 【android】Android Studio项目打包,发布APK
- 2015年广东工业大学编译原理课设
- 常用的正则表达式
- [转]adb shell dumpsys 命令
- 58.UIView动画第二章(简单)
- 由后缀数组构造字典序最小的原串