Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post" action="htts://www.ipay.com.np/api/v2/recharge">
- <div class="col-md-6">
- <div class="form-group">
- <label for="email">Username:</label>
- <input type="email" name="username" class="form-control" id="username" placeholder="Enter username">
- </div>
- </div>
- <div class="col-md-6">
- <div class="form-group">
- <label for="pwd">Password:</label>
- <input type="password" name="password" class="form-control" id="pwd" placeholder="Enter password">
- </div>
- </div>
- <div class="col-md-12">
- <div class="form-group">
- <label for="choose">Amount:</label>
- <select name="mid" class="form-control" id="mid" placeholder="Query">
- <option value="null">what-would-you-like-to-do</option>
- <option value="37">NTC-POSTPAID RECHARGE</option>
- <option value="35">NTC LANDLINE PSTN</option>
- <option value="20">NCELL AIRTIME</option>
- <option value="36">NTC PREPAID</option>
- <option value="33">ADSL UNLIMITED</option>
- <option value="39">ADSL VOLUME</option>
- <option value="46">UTL TOPUP</option>
- </select>
- </div>
- </div>
- <div class="col-md-6">
- <div class="form-group">
- <label for="phone">Phone Number:</label>
- <input type="text" name="phone" min="1" class="form-control" id="phone" placeholder="Enter phone number">
- </div>
- </div>
- <div class="col-md-6">
- <div class="form-group">
- <label for="amount">Amount:</label>
- <select name="amount" class="form-control" id="email" placeholder="Enter email">
- <option value="null">select-amount</option>
- <option value="Rs.10">10</option>
- <option value="Rs.20">20</option>
- <option value="Rs.30">30</option>
- <option value="Rs.40">40</option>
- <option value="Rs.50">50</option>
- <option value="Rs.100">100</option>
- <option value="Rs.100+">100+</option>
- </select>
- </div>
- </div>
- <div class="col-md-6">
- <div class="checkbox">
- <label><input type="checkbox"> Remember me</label>
- </div>
- </div>
- </div>
- <button type="submit" class="btn btn-default">Submit</button>
- </form>
- </div>
- {
- "txn_no" : 12343,
- "ord_no" : 1222,
- "status" : "paid",
- "merchant" : "Ncell Air time",
- "description" : "recharge of...",
- "amount" : 20.00, "reward" : 0.02
- }
- public boolean validateLogin()
- {
- try {
- progressBar.setVisibility(View.VISIBLE);
- //call webservice and get json response
- String JSONStr = PostData();
- jsonObject = new JSONObject(JSONStr);
- String status = jsonObject.get("success").toString();
- return status.equals("1");
- }
- catch (Exception e)
- {
- return false;
- }
- }
- public String PostData() {
- String jsonResponse = "";
- String URL = "https://example.com/Login.php?Email=" + str_email + "&Password=" + str_password;
- try {
- HttpClient httpClient = new DefaultHttpClient();
- HttpPost httpPost = new HttpPost(URL);
- HttpResponse httpResponse = httpClient.execute(httpPost);
- HttpEntity httpEntity = httpResponse.getEntity();
- jsonResponse = readResponse(httpResponse);
- } catch (Exception exception) {
- }
- return jsonResponse;
- }
- public String readResponse(HttpResponse res) {
- InputStream is = null;
- String return_text = "";
- try {
- is = res.getEntity().getContent();
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
- String line = "";
- StringBuffer sb = new StringBuffer();
- while ((line = bufferedReader.readLine()) != null) {
- sb.append(line);
- }
- return_text = sb.toString();
- } catch (Exception e) {
- }
- return return_text;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement