Advertisement
Guest User

Untitled

a guest
Mar 31st, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. <form method="post" action="htts://www.ipay.com.np/api/v2/recharge">
  2. <div class="col-md-6">
  3.  
  4. <div class="form-group">
  5. <label for="email">Username:</label>
  6. <input type="email" name="username" class="form-control" id="username" placeholder="Enter username">
  7. </div>
  8. </div>
  9.  
  10. <div class="col-md-6">
  11.  
  12. <div class="form-group">
  13. <label for="pwd">Password:</label>
  14. <input type="password" name="password" class="form-control" id="pwd" placeholder="Enter password">
  15. </div>
  16. </div>
  17.  
  18. <div class="col-md-12">
  19.  
  20. <div class="form-group">
  21. <label for="choose">Amount:</label>
  22. <select name="mid" class="form-control" id="mid" placeholder="Query">
  23. <option value="null">what-would-you-like-to-do</option>
  24. <option value="37">NTC-POSTPAID RECHARGE</option>
  25. <option value="35">NTC LANDLINE PSTN</option>
  26. <option value="20">NCELL AIRTIME</option>
  27. <option value="36">NTC PREPAID</option>
  28. <option value="33">ADSL UNLIMITED</option>
  29. <option value="39">ADSL VOLUME</option>
  30. <option value="46">UTL TOPUP</option>
  31.  
  32. </select>
  33. </div>
  34. </div>
  35.  
  36. <div class="col-md-6">
  37.  
  38. <div class="form-group">
  39. <label for="phone">Phone Number:</label>
  40. <input type="text" name="phone" min="1" class="form-control" id="phone" placeholder="Enter phone number">
  41. </div>
  42. </div>
  43. <div class="col-md-6">
  44.  
  45. <div class="form-group">
  46. <label for="amount">Amount:</label>
  47. <select name="amount" class="form-control" id="email" placeholder="Enter email">
  48. <option value="null">select-amount</option>
  49. <option value="Rs.10">10</option>
  50. <option value="Rs.20">20</option>
  51. <option value="Rs.30">30</option>
  52. <option value="Rs.40">40</option>
  53. <option value="Rs.50">50</option>
  54. <option value="Rs.100">100</option>
  55. <option value="Rs.100+">100+</option>
  56. </select>
  57. </div>
  58. </div>
  59.  
  60. <div class="col-md-6">
  61.  
  62. <div class="checkbox">
  63. <label><input type="checkbox"> Remember me</label>
  64. </div>
  65. </div>
  66. </div>
  67.  
  68. <button type="submit" class="btn btn-default">Submit</button>
  69. </form>
  70. </div>
  71.  
  72. {
  73.  
  74. "txn_no" : 12343,
  75.  
  76. "ord_no" : 1222,
  77.  
  78. "status" : "paid",
  79.  
  80. "merchant" : "Ncell Air time",
  81.  
  82. "description" : "recharge of...",
  83.  
  84. "amount" : 20.00, "reward" : 0.02
  85.  
  86. }
  87.  
  88. public boolean validateLogin()
  89. {
  90. try {
  91. progressBar.setVisibility(View.VISIBLE);
  92. //call webservice and get json response
  93. String JSONStr = PostData();
  94. jsonObject = new JSONObject(JSONStr);
  95. String status = jsonObject.get("success").toString();
  96. return status.equals("1");
  97. }
  98. catch (Exception e)
  99. {
  100. return false;
  101. }
  102. }
  103. public String PostData() {
  104. String jsonResponse = "";
  105. String URL = "https://example.com/Login.php?Email=" + str_email + "&Password=" + str_password;
  106. try {
  107. HttpClient httpClient = new DefaultHttpClient();
  108. HttpPost httpPost = new HttpPost(URL);
  109.  
  110. HttpResponse httpResponse = httpClient.execute(httpPost);
  111.  
  112. HttpEntity httpEntity = httpResponse.getEntity();
  113. jsonResponse = readResponse(httpResponse);
  114. } catch (Exception exception) {
  115. }
  116. return jsonResponse;
  117. }
  118.  
  119. public String readResponse(HttpResponse res) {
  120. InputStream is = null;
  121. String return_text = "";
  122. try {
  123. is = res.getEntity().getContent();
  124. BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
  125. String line = "";
  126. StringBuffer sb = new StringBuffer();
  127. while ((line = bufferedReader.readLine()) != null) {
  128. sb.append(line);
  129. }
  130. return_text = sb.toString();
  131. } catch (Exception e) {
  132.  
  133. }
  134. return return_text;
  135.  
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement