I am creating a project in android studio. I am getting this error while retrieving information from a sql server database. I am using .php files for database connection. On debugging I found that the following line is generating the error :
inputStream = urlConnection.getInputStream();
On further inspection I have found that if I access my PHP files(which are used to query sql-server) over https:// then the project is running well........but whenever I am accessing my php files over http://, the IOException is raised.
The problem was caused by a space in query string of url. Browser and Postman seem to detect and automatically correct this error.
I also have this problem. got solved by using trim() function in variables used in URL.
Related
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.
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
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 .
I want to extract data from the table on this link using JSoup. When I try to run the following code in a Java Application Project in Eclipse I am successfully able to do so. However,when I use that same code in my Android Project it gives me 403 error loading URL.
This is my code:
try{
Connection c=Jsoup.connect("http://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?date=29DEC2011");
//System.out.println("got connection "+c.toString());
Document doc=c.get();
//System.out.println("reached");
}
catch(Exception e){
e.printStackTrace();
}
In the Stack Trace it shows an error on Document doc=c.get(); line so that means there is something wrong with the get() method.
What should I do to rectify this and successfully parse the page?
Use:
response.ignoreHttpErrors(false);
to disable gets Server Errors (for example: 403. 404, etc.). If you disable, you can get code HTML from page.
When trying to get some data on my android client from my webservice (running on app-engine) with this code
ClientResource cr = new ClientResource("https://myapp.appspot.com/restlet/service/");
IServiceResource res = cr.wrap(IServiceResource.class);
m_Services = res.getServices();
I get this error:
05-20 08:30:15.406: ERROR/AndroidRuntime(31767): Caused by: Communication Error (1001) - Could not change the mode after the initial handshake has begun.
i have the org.restlet.ext.ssl.jar for the https-support and i am using this line to add the client
Engine.getInstance().getRegisteredClients().add(new HttpsClientHelper(null));
this is the closest i have come to getting https:// calls to work since i moved up to restlet 2.1m4 (moved because i was in need of entityBuffering..)
Any ideas?
Any other information i need to share?
Got it working.
Changed HttpClient to org.restlet.ext.net.
On Android, you are told to do this to change the client
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));
However nothing changes by doing so, instead, i had success with
Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));
This solves the issu(be sure to have org.restlet.ext.ssl in your build path aswell).
This also solves other issues such as the "Internal Connector Error (1002) - The calling thread timed out while waiting for a response to unblock it."
I had worked with web service using ksoap2, u can try using ksoap2 by downloading the jar and including in ur project.