0

The problem i am having is that i am unable to so save information from my ios application to my web server, I am currently app to retrieve the data using JSON and parsing that data.

I have written the php code for the request and it is stored on my server:

...else
{
    // updating record
    $q = sprintf("update phone_book set name = '%s', phoneNumber = '%s', email = '%s', phoneNumber = '%s' where name = '%s'",
        mysql_real_escape_string($_GET["name"]),
        mysql_real_escape_string($_GET["phoneNumber"]),
        mysql_real_escape_string($_GET["email"]),
        mysql_real_escape_string($_GET["address"]));
}   

However I have looked everywhere and am unable to find information on how i could use post this information from my application to the web server.

Would appreciate any help. Thanks!

Asim
  • 13
  • 4

2 Answers2

0

Use this api for post and get calls and object mapping https://github.com/RestKit/RestKit

RyanCodes
  • 175
  • 1
  • 5
0

This actually wasent to hard. Another option instead of using REST was to POST JSON from the iOS application sending the JSON to a site where a php file contains the code. The fixed code inside the PHP would look like:

    ...
$json_post = json_decode(file_get_contents ('php://input'),1);
$name = $json_post['name'];
$phone = $json_post['phone'];

$aQuery = "UPDATE phone_book SET phoneNumber = '$phone' WHERE name = '$name' ";

mysql_query($aQuery);

...

If anyone requires anymore help feel free to leave a comment. Good Luck!

Asim
  • 13
  • 4