tags:

views:

29

answers:

1

Hi, i will be sending a POST request to login.php on my server from an iphone app over HTTPS. The POST is created using NSMutableURLRequest. Is there an example of a PHP script to process this POST on my server. The POST isn't sent as a form as such , anyway not that i think it is. Not sure how NSMutableURLRequest formats this. I just need to know how to access the POST data on the server with the php script.

All the examples ive seen regarding php scripts processing POSTS seem to be do with forms. So how do i process this? Any links etc most welcome.

Thanks

A: 

You can access any POST data via the $_POST array in PHP:

An associative array of variables passed to the current script via the HTTP POST method.


The HTTP POST method itself has nothing to do with forms (it is just often used with forms). It is another way to transmit data, compared to GET.

With GET, the parameters are appended to the URL, with POST, they are in the HTTP message body.

Make yourself familiar with HTTP.

Felix Kling
Thank you for clarifying that
tech74
Hi , i tried sending the POST and i can see its going out to the server using Wireshark. Just testin with http initially to get it workingthe post has the following datausername=userecho "Password = {$_POST['password']}";?>However when i run the php script after the eventlike this php process.php from a bash shell theni get nothing printed out. What could be going on?Thanks
tech74