0

I am using the ASIHTTPREQUEST library and successfully posting data to a php script.

I do however have a single script holding related functions and I would like to call these functions from iOS.

Is this possible? if so is it a good way to do this or should one use isset($_POST['blah']) for the argument and another isset and pass in the function name?

some_id
  • 29,466
  • 62
  • 182
  • 304

1 Answers1

2

Yes, you can simply use POST or GET when you call the script if this script runs on a different server. You could try to use the way subscribed on this page:

ASIHTTPRequest post json to php server

You could post an array with index 'action' where you can wrap an Switch-case over.

$action = isset( $_POST['action'] )? $_POST['action']: false;

switch( $action ) {
    case 'function':
        // Do your thing
      break;
    default:
        // Unknow call
      break;
}
Community
  • 1
  • 1
Sietse
  • 623
  • 1
  • 8
  • 23