Category Archives: android-webservice

My website stops working when I request data from my Android application

I created an android application that makes some requests to a website and gets back data in JSON format, but when I make a request to a specific PHP file, something weird happens: the whole website stops working. The webpage does not load at all. It's like the site does not exist and obviously that happens automatically from my Internet Provider.

In the error log I get a record that says something about the header:

[Fri Jul 11 19:17:26 2014] [error] [client] ModSecurity: [file "/etc/httpd/crs/activated_rules/modsecurity_crs_21_protocol_anomalies.conf"] [line "84"] [id "960904"] [rev "2"] [msg "Request Containing Content, but Missing Content-Type header"] [severity "NOTICE"] [ver "OWASP_CRS/2.2.8"] [maturity "9"] [accuracy "9"] Warning. Match of "rx ^0$" against "REQUEST_HEADERS:Content-Length" required. [hostname ""] [uri "/webservice/MYPHPFILE.php"] [unique_id "U8AOFn8AAAEAABq-qs8AAAEt"]

Is that so serious an error that my provider stops my site on every request?

In my php file, what I do is:

  1. connect to my db
  2. execute a select statement
  3. echo the SQL results (in order to send them to Android device) like this:

       header('Content-type: application/json');
       echo (json_encode(array('notifications'=>$result)));

Has anyone faced that problem when trying to request data from a web server?