0

Here is the situation :

  • I have rented a server where php 5, apache2 are up and running.
  • I'm doing HTTP POST request on my iOS App using NSMutableURLRequest and NSURLConnnection.
  • I'm sending data as following :

    NSMutableDictionary *postDictionnnary = [NSMutableDictionary dictionaryWithObjects:@[@"login",username,password]
                                                                                forKeys:@[@"type",@"username",@"password"]];
    NSData *requestBodyData = [NSKeyedArchiver archivedDataWithRootObject:postDictionnnary];
    request.HTTPBody = requestBodyData;
    
    1. Is this the right way ?
    2. On my server, in my php file, where do i get those datas ? $_REQUEST seem empty.

Thanks !

Ambroise Collon
  • 3,839
  • 3
  • 18
  • 37

1 Answers1

0

try adding a method to request

request.HTTPMethod = @"POST"

In your php file, you should be able to retrieve your data using $_POST['key'];

Sean
  • 1,534
  • 12
  • 20