我有一個iPhone遊戲,我用套索網頁分數添加到MySQL數據庫。 它現在工作正常,但我得到一個'用戶',連續提交數百個不可能的好分數。我知道這不可能做到'合法'的方式。 我現在正在更新應用程序,並希望避免這樣的廢話。 我最初的想法是去Game Center,我會這樣做,但這個更新幾乎是完美的,所以我寧願不再打開它。驗證iPhone HTTP請求
什麼是測試如果一個HTTP請求從我的應用程序來使用iOS deviced而不是從某些機器人或腳本的好辦法?
謝謝! Hanaan
這是我的請求代碼:
int gameTypeId = 1; // Nonograms=1, Nonograms iPad=2, LoopMaster=3
NSString *name = [[NSUserDefaults standardUserDefaults] objectForKey:@"player_name"];
NSString *place = [[NSUserDefaults standardUserDefaults] objectForKey:@"player_where_from"];
NSString *scoreString = [self formatFinalScore];
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
[parameters setValue: name forKey: @"name"];
[parameters setValue: place forKey: @"place"];
NSString *post1_encodestrings = [@"" stringByAppendingString: [parameters urlEncodedString]];
NSString *post1 = [NSString stringWithFormat: @"game_id=%d&game_size=%d&game_level=1&score=%f&score_string=%@&%@",gameTypeId,self.thisGameSize,self.gameFinalScore,scoreString,post1_encodestrings];
NSData *postData = [post1 dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init]autorelease]; //
[request setURL:[NSURL URLWithString:@"http://www.tmipublishing.com/hotcocoa/lasso/add_score_to_database.lasso"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
悅 - 我會考慮HTPPS,謝謝! – 2010-11-01 10:47:09