Search code examples
phpiosweb-serviceswebservice-client

$_POST failed in web services?


I am stuck for two days, I am working with web services and this web services is make request from iOS, They are send request with $_POST method but it is not working.

I tried to print_r($_POST) but its return blank Array() and also try with $_REQUEST but its return blank Array() only GET method work proper.

I also make <form> and try to submit with POST method and print both $_POST and $_REQUEST then both are work proper.

When print $_SERVER['REQUEST_METHOD'] then it return GET.

Please does anyone know how it happenned?


Solution

  • Here, I am able to find my answer and issue. For mod_rewrite is change request method. If you have a rewrite rule that affects the action URL, you will not able to read the POST variable.

    You have to add this rule to .htaccess , at the beginning, to avoid to rewrite the url:

    RewriteRule ^login.php - [PT]