开发者

NSURL & PHP Connection

开发者 https://www.devze.com 2023-02-22 00:52 出处:网络
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=%@&

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

精彩评论

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