We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Eric Uche • 12 months ago

my app is not connecting to database. it keeps showing "connect timed out"

Swapnil Gawali • 3 years ago

how to devide functions to seperate file. like register.php & login.php?

Luís Cunha • 3 years ago

Nice to see this article updated. I has served me well when I was just starting my career.

Ali O. Al-Souqi • 2 years ago

hi>>can you tell me how can i run this app|?

sunil kumar • 2 years ago

It's so easy..
import codes in android studio.
Install a wamp server for run php script.
url like . localhost/php_api
and database url is localhost/phpmyadmin

Jaydeep Bhayani • 2 years ago

hii sir,
I'm not able add more column in this php service can you tell me the problem

"name":"Raj Amal",

{"result":"failure","message":"Invalid Parameters"}

Oliver • 1 year ago

did you solve this problem? please share if you do here's my email nwanime@gmail.com Your response is deeply appreciated. Thanks in advance.

Prateek Sharma • 1 year ago

hello i just run the code . when i am clicking on register button i am getting response in snackbar like this :status , header is missing but data is entering in mysql

praveen singh • 2 years ago

anyone can help me to direct login(admin login) with our database through android app ....

Rahul Rajputh • 2 years ago

hey guys if you get ---Invalid Parameters--- or invalid password_hash ERROR
the try this code on DBOperations.php it is work for me,,, replace the code from line no.117. https://uploads.disquscdn.c...

public function getHash($password) {

$salt = sha1(rand());

$salt = substr($salt, 0, 10);

$encrypted = $salt ;

$hash = array("salt" => $salt, "encrypted" => $encrypted);

return $hash;


public function verifyHash($password, $hash) {

return $password.$hash;



ßlack Wizard • 2 years ago

Hello can you tell me how can i use my database
Its look like this

`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_login` varchar(60) NOT NULL DEFAULT '',
`user_pass` varchar(255) NOT NULL DEFAULT '',
`user_nicename` varchar(50) NOT NULL DEFAULT '',
`user_email` varchar(100) NOT NULL DEFAULT '',
`user_url` varchar(100) NOT NULL DEFAULT '', ( not needed)
`user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',(not needed)
`user_activation_key` varchar(255) NOT NULL DEFAULT '',(not needed)
`user_status` int(11) NOT NULL DEFAULT '0', (not needed)
`display_name` varchar(250) NOT NULL DEFAULT '',

ibrahim • 6 months ago

How do I do these codes in my android project?
please help me ibrahimcss@outlook.com

Fazrian Ramadlan Sumarna • 9 months ago

hi, i have try create api for android apps android studio, when the api in the localhost, it run normally. but when i move the api to the cpanel, the android apps wont login. can u help me? thx.. u can email me fajriramsu@gmail.com. thx a lot

Amruta Patil • 3 months ago

hi, even i facing the same problem did u get the solution.? can u help me? please mail me at amrutapatil599@gmail.com. Thank you

Bulbul Hossen • 10 months ago

How can I solve this problem, please help sir
Two Problem show
* Registration is done, but when you log in, this warning message shows
* when password reset , this warning massage show


zohaib hassan • 1 year ago

where is autoload.php file in ths phpMail autolodfile miss. but in function.php file you have add require this file.

Ayushi Mundra • 1 year ago

I need help that I want to reset the password . Getting Error in Library importing . Help me out .

Raj Amal • 1 year ago

Can you post the error message

Lloyd Ramos • 1 year ago


Please help me. I used this tutorial to my thesis very helpful but i can't fixed it. please help me sir. Thank you so much!!!

Mahantesh Gurav • 1 year ago

Did you solve this? I also have the same problem.

RAHUL SAH • 1 year ago

any1 solved it pls rply

Sabarish Don • 1 year ago

how to get functions

Aliasgar Lokhandwala • 1 year ago

Hi All,

Has anyone solved this problem?

Use JsonReader.setLinient(true) to accept malformed JSON at line 1 column 1 path$

Edgar Valdés • 1 year ago

In my case, it was a problem with utf8 encoding. In the file DBOperations.php, I added the utf8 charset.

$this -> conn = new PDO("mysql:host=".$this -> host.";dbname=".$this -> db, $this -> user, $this -> pass,array('charset'=>'utf8'));

$this -> conn -> query("SET CHARACTER SET utf8");

Suraj Giri • 1 year ago

yes I am having the same problem . Please do tell me and explain me how to resolve it if you have resolved it earlier

Edgar Valdés • 1 year ago

See my answer above.

Armand • 1 year ago

Hi for those that had the same problem as me I just came across my error. I had everything working as I was working with a cpanel site however when I tried testing the web service it kept on only showing: "Learn2Crack Login API". This was by using postman as per guidance from video tutorial. I had my path set as:

however after 2 days I discovered that I had a missing "/" and by adding that my path worked correctly and I succeeded as per video


Fixed my error

Aliasgar Lokhandwala • 1 year ago

Hi Raj,

Great tutorial. Can you please show if we can use DBoperations with MSSQL.

Abdulkarim Khorajiya • 1 year ago

how to insert record after verify otp.

If first time i am register but without verify otp i go to the main activitu by pressing the back button.

While i register 2nd time.
email is already in use. Message arrive. My logic is if user not verify then record not insert on database.

how to implement?

Priyansh Mishra • 1 year ago

how to register with this , what is the path or url ?and what fields to be put into postman

amreky2005 • 1 year ago

Thanks very much for sharing this!!

I just have a quick question if someone can help:

Using postman when I input:

"name":"Raj Amal",

And I do get a successful reply:

"message":"User Registered Successfully !"

But when I check on the users created in phpmyadmin database there is nothing there. Any suggestions on what is causing this?

If I try to login as a user it fails indicating that nothing indeed was added to the database.

Any help will be very appreciated!!

Isaoshi Aoki • 2 years ago

Hello Raj Amal.
Excellent tutorial. Thank you very much for sharing. But I have a question how can I send json in another way like this:



Yusuf Charles • 2 years ago

i cannot see the mail for reset password after requesting a password reset. I am using my computer IP address ( i checked my gmail several times but not found. Please help.

Raj Amal • 2 years ago

What function you are using to send Email ? sendPHPMail() or sendEmail() ?

Yusuf Charles • 2 years ago

sendPHPMail returns error
Use JsonReader.setLinient(true) to accept malformed JSON at line 1 column 1 path$

Mohammad N • 2 years ago

Hi Raj, how can i show message for utf-8 ?
I change message text for my language (utf-8) but not show and just show  575;&# 1610;& #1606;  75;& #1610; 05;ي& #16 04; ق ;ب& # 1604;ا

how can i fix it?

Parimal Debbarma • 2 years ago

Very nice tutorial.It works fine.But I have a problems.How to start activity with a button from ProfileFragments.

anmolsharma • 2 years ago

"" Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ ""
getting this error after click on forgot password.... how to resolve

ahmad • 2 years ago

hello ...
please how can i edit the "php:// input" ??
i want to add a number text field in the registartion code ...

Raj Amal • 2 years ago

You can fetch the additional JSON object in PHP by

$newField = $user -> newField;

And while sending you need to add that field as JSON object to the existing JSON.

ahmad • 2 years ago

okii then how can i add number field in the jason ??
i update the database and the php files and the java code but i have thi error when i click on the register button !!
"" Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ ""
pleaaaaase help me what can i do to fix that !!

Trynos Tira Munya Much • 2 years ago

The app keeps on crushing please help and i need the libs for retrofits2.....how can i use volley and remove retrofits?please can you do the tutorials for volley in the same app.

Thanks Raj!!!

B3NN1TH • 2 years ago

Had issues where i was getting invalid parameters ... make sure to have index.php in the @POST request.
Also I upgraded to PHP5.6 from PHP5.59 but not sure if that also helps... probably just a case of the @POST

Call<serverresponse> operation(@Body ServerRequest request);

Shiroyasha • 2 years ago

Hey, i got a little question regarding on the mobile system. How to get rid off the verifyHash because i want to connect to my web system. The login of the mobile system expect encrypted password but my web system has no enryption password. I just figured out on how to register without enryption but i dont know how to get rid off the verifyHash that expect a enrypted password during log in. https://uploads.disquscdn.c...

Raj Amal • 2 years ago
public function checkLogin($email, $password) {
$sql = 'SELECT * FROM users WHERE email = :email';
$query = $this -> conn -> prepare($sql);
$query -> execute(array(':email' => $email));
$data = $query -> fetchObject();
$db_password = $data -> password;

if ($password == $db_password) ) {
$user["name"] = $data -> name;
$user["email"] = $data -> email;
$user["unique_id"] = $data -> unique_id;
return $user;
} else {
return false;

Assuming the column name in which you store password is password.

sunil kumar • 2 years ago

Dear sir i have created a file chooser i want to store images of file own my server and database. Fill help me.
Thank you So much..

Andrew Pang • 2 years ago

How do I get the JSON request and response ?

Yusuf • 2 years ago

I did exactly what you say and when i try in postman it says succesfull but i cant see anything created in phpmyadmin?

Sisekelo Dlamini • 2 years ago

How can I test it with Post man? I am not sure what to add in the parameters and what is the url I should use to test?

Yusuf • 2 years ago

Ifound the answer. I created table with GUI because SQL commands didn't work for some reason. And replaced the commands in DBOperations.php with
$query = $this->conn ->prepare("Insert Into users (name, email, encrypted_password, salt, unique_id) Values(:name, :email, :encrypted_password, :salt, :unique_id)");
$query->execute(array(':name' => $name, ':email' => $email, ':encrypted_password' => $encrypted_password, ':salt' => $salt, ':unique_id' => $unique_id));