I have the following api on phpmyadmin. Now i want to learn how to send the email and password (String values) using volley lib.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends MX_Controller {
public function index()
{
$json = file_get_contents('php://input');
$obj = json_decode($json, true);
$email = $obj['email'];
$password = $obj['password'];
if ($obj['email']!="") {
$this->load->module('camps');
$mysql_query = "SELECT * FROM accounts where email='$email' and password='$password'";
$result = $this->camps->_custom_query($mysql_query);
$query = $result->num_rows();
if ($query==0) {
echo json_encode($password);
}
else {
echo json_encode('OK');
}
}
else {
echo json_encode('Try Again');
}
}
}
}
I have already tried using getParams()
method like this but its not working.
Note: uname and password are EditTexts
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("email",uname.getText().toString());
params.put("password",password.getText().toString());
return params;
}