0

I am having a php script and I want to send parameters to it. In android I successfully use that code:

Can you help me with the equivalent code in Obj-C?

 nameValuePairs.add(new BasicNameValuePair("table", table));
         nameValuePairs.add(new BasicNameValuePair("code", Integer.toString(code)));
         nameValuePairs.add(new BasicNameValuePair("name", temp_name));
         nameValuePairs.add(new BasicNameValuePair("email", email));

I know how to fetch data from php or call a http script, I just don't know hot to send these paramterers to php.

In php side my code is this:

$table.=$_POST['table'];
$code.=$_POST['code'];
$name.=$_POST['name'];
$email.=$_POST['email'];
ghostrider
  • 5,131
  • 14
  • 72
  • 120

1 Answers1

1

The proof is in the pudding: iOS: how to perform a HTTP POST request?

I would suggest though, that you use a NSDictionary object to hold your values and JSON encode. Take the JSON data and submit it to the server. Use JSON decode within your PHP script to decode and work the results.

Community
  • 1
  • 1
Mike Mackintosh
  • 13,917
  • 6
  • 60
  • 87