android POST - Unexpected response code 403 - android

I want to add user inputs to web server. I use PHP and MySQL to store data. The app POSTs data to http://url_address/getData.php .
On localhost while I POST to http://192.168.1.38/getData.php everything works OK and data being inserted to database.
I also used https://www.000webhost.com/ to test my code and the data is inserted to that server. I could see from phpmyadmin.
But when I change address to my web address http://mywebsite.com/getData.php I get an error
E/Volley: [208] BasicNetwork.performRequest: Unexpected response code 403 for http://... I use hosting from https://ifastnet.com/
I googled and found that I have to change my httpd.conf file as belov:
<Directory />
AllowOverride none
Require all granted
</Directory>
But I use shared hosting plan and I cannot change httpd.conf , insted I should use .htaccess file. But when I use .htaccess I get below error:
A 500 error has occured
500 errors are generally caused by one of the following two problems.
1) A bad entry in the site .htaccess file, if you are the webmaster
try logging into your cPanel, and use the file manager to rename your
.htaccess file if this fixes the error you should then check the
contents of the .htaccess file / roll back any recent changes.
2) A php error / code error also causes a 500 error, you can try
enabling 'PHP display_errors' by following this guide Enable Display
errors
If after trying both of the above solutions and you are still seeing
the 500 error please do contact support
help me to overcome this problem.

Related

I am getting an 403 error when I am trying to access an api through my app

I am a bit new to android development. I was using an api form newsapi.org and every time I am getting
a some thing like this while api callSee the last line in run log
Can any body help me with this, like is there might be a problem from my end or some thing else?...Thanks in advance
The 403 Forbidden error is an HTTP status code that means that accessing the page or resource you were trying to reach is absolutely forbidden for some reason and you don't have permission to access [directory] on this server. I saw your attached image and I think maybe your api key is out dated.

403 AuthFailureError in Volley

I am having a very strange situation. I have a running script that makes JsonObjectRequest using Volley Singletone. The script has been working perfectly in domain example1.com. Recently I bought example2.com and hosted in the same hosting account. And when I copy all the php files as it is in the second domain, I am getting error "BasicNetwork.performRequest: Unexpected response code 403".
So, I have exactly same php files called using JsonObjectRequest and Volley Singletone working in example1.com, but not in example2.com. I have check the permission of the files in both domain, they are exactly same (644) and there is no htaccess in either of the domain.
I am stuck and don't understand what else I should check?
Any help will be highly appreciated.
Problem is with your server side php script - You can first try to test POST requests using some tool before implementing in your Android application:
If I performed a simple POST request (just using browser not Android) to your provided link I get following error:
403: Forbidden
403 Forbidden Forbidden You
don't have permission to access /mylibman_4_5.php on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request. Apache
Server at mylibrarymanager.com Port 80

Internal server Error Using http UrlConnection

I was referred to this
link(Upload large file in Android without outofmemory error)
for send internal storage file to server After that i got error
internal server error code 500.In my previous app, it was working perfectly
Is this client side or my server side problem?
I am using file directory :-
File mydir = context.getDir("mydir",Context.MODE_PRIVATE);
This is a error which can be occur due to your mistake.I think you should also post your code with you question which would also help us to understand what you are doing and will easy to amplify your mistake. I am referring you to this link which explains more about server error (error code 500) here and check the timeout you are using in your code .

Phone can't connect to PC to execute PHP file

I created a database in my PC, and now I want to retrieve all table data and display them on my phone usin Google gson library by executing a php file in the server. The problem is the phone can't connect to the PC to execute that php file:
Error 403 for URL http://192.168.1.2/android_connect/get_all_products.php
I'm sure that the code is working cause i tested with that online link and data are retrieved in the phone.
The url is like that in JAVA code:
String url = "http://192.168.1.2/android_connect/get_all_products.php";
Is that correct? Is there something to do to let the phone connect to the PC?
Thank you for helping.
You need to tune your PC's configuration to allow remote requests. Please see what error 403 is. It'd also help to check what's in your HTTPD logs concerning this request.
To allow remote access to apache on Windows change the file: c:\wamp\bin\apache\Apache2.2.22\conf\httpd.conf
You need to allow remote access to directory C:\wamp\www like this:(add that lines)
<Directory "C:/wamp/www/">
Order Deny,Allow
Allow from all
</Directory>
And RESTART YOUR SERVER.

Why does my django development server keep responding with 403, how do I allow POST?

So I have a django development server that I want to be the backend for my android app. For the time being, its I am just running the development server on my local machine.
I've been able to successfully retrieve data from the server, but I am now trying to POST data to the server through a JSON object, however I keep getting error code 403 in response. The method in my views.py file doesn't even get called, it just automatically response with 403. Heres what the server response looks like in the terminal.
[28/Nov/2011 17:58:40] "POST /createUser/ HTTP/1.1" 403 2326
Here is the url in my urls.py
url(r'^createUser/$', 'mydb.views.createUser'),
But I am always getting this 403 error, does anyone know why?
Possibly also important:
when I remove django.contrib.auth and django.contrib.contenttypes from INSTALLED_APPS I get a different print out from the server in the terminal: (error code 500 instead)
[28/Nov/2011 17:32:31] "POST /createUser/ HTTP/1.1" 500 82471
So I am thinking there is some sort of permissions issue going on.
For a quick fix, try adding #csrf_exempt decorator to the view:
from django.views.decorators.csrf import csrf_exempt
#csrf_exempt
def createUser(request):
That said, for a back end API, definitely read up on CSRF
I read the following link about CSRF tokens: docs.djangoproject.com/en/dev/ref/contrib/csrf
Then I turned off middleware since I am just on the localhost for the time being.

Categories

Resources