4
我试图从我的应用程序发送一个建议到我的Web服务器上的一个PHP文件,我已经在我的浏览器中测试了php脚本,它向用户发送一封电子邮件并将建议存储在我的数据库中,这一切都正常。 。并运行下面的脚本,我得到通过IOS连接成功,但是我没有收到我的数据库中的结果..使用IOS 5创建HTTP GET请求的最简单方法是什么?
NSString *post = [NSString stringWithFormat:@"http://blahblah.com/suggest.php?s=%@&n=%@&e=%@", suggestion, name, email];
// Create the request.
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:post]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
NSLog(@"Connection establisted successfully");
} else {
NSLog(@"Connection failed.");
}
我已经检查了所有的字符串时,和编码为%20等所有空间。可任何人都会看到明显的原因,为什么我的脚本不能工作?
什么是最简单的方式来从我的应用程序发出的HTTP请求,而无需打开Safari浏览器?