Connecting to Remote database using Android volley

sureshkumarct

Member
Mar 2, 2024
5
2
3
Visit site
Hi,

I am new to Android development. I have a database in Hostinger. I am trying to input a record into a table in this database from my android app using Volley. When I try to submit the data, I am getting AuthFailure error. In order to connect to I have create a php file in hostniger in my account under piblic_html.(public_html/databaseconnect.php). For this I followed the link https://www.hostinger.in/tutorials/how-to-connect-php-to-mysql.
Below is my php file. Hiding credentials...

View attachment 360525
And in my Andoid application, i a entring teh data as below

1709378433150.png

When I submit the data, I am getting, com.android.volley.AuthFalureError. I understand its is 403 error. For the URL in StringRequest, I am using the direct link of the php file. ie. open the php file from hostinger and use the address seen in address bar.
Like https://xxx/xxxxxx/public_html/databaseconnect.php
What is wrong here? If change the method to GET and use google.com as url, I am getting proper response. Could someone please help me here?
 

B. Diddy

Senior Ambassador
Moderator
Mar 9, 2012
165,606
4,756
113
Visit site
Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.