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瀏覽器?