我的问题是我无法将短信发送到服务器。我正在使用 asihttprequest。我自己定义了 USERNAME、UUID、PASSWORD、API_PASSWORD 和 NUMBER。我想要做的只是将数据发送到给定的服务器 url。这是我的代码:
- (IBAction)sendClicked:(id)sender {
[sendButton resignFirstResponder];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"https://cc.frifon.net_dosmssend/"]];
[request setDelegate:self];
[request setNumberOfTimesToRetryOnTimeout:3];
[request setRequestMethod:@"POST"];
[request setPostValue:USERNAME forKey:@"sip"];
[request setPostValue:PASSWORD forKey:@"pwd"];
[request setPostValue:UUID forKey:@"uuid"];
[request setPostValue:API_PASSWORD forKey:@"key"];
[request setPostValue:messageText forKey:@"message"];
[request setPostValue:NUMBER forKey:@"to"];
[request setPostValue:@"Submit" forKey:@"submit"];
[request start];
nil;
[request startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request {
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
messageText.text = response;
}
}