开发者

NSURL & PHP Connection

i m trying to use this code for objective c connection with php mysql......

    NSString *urlstr = [[NSString alloc] initWithFormat:@"http://61.17.213.62/r_o_t/hemen/contactFile/chkbook.php?fname=%@&lname=%@&num=%@&eml=%@",firstname.text,lastname.text,mobile.text,email.text];
    NSLog(@"urlstr :%@",urlstr);

    NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:urlstr] ];
    NSLog(@"the request :%@",theRequest);

    NSData *returnData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil];
    NSLog(@"returndata :%@",returnData);

    NSString *listData = [[NSString alloc] initWithData:returnDat开发者_JAVA技巧a encoding:NSASCIIStringEncoding];
    NSLog(@"listData :%@",listData);

is there any other way to connect with php mysql....?


There is other way like using ASIHTTPRequest (http://allseeing-i.com/ASIHTTPRequest/) but it will be almost the same.

  1. Create the url
  2. Create the request
  3. Send the request
  4. Get data
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜