我试图发送数据或网站上的表单看似什么,操作是freecontactformprocess.php
,我的代码是这样的,
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.irabwah.com/freecontactformprocess.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
NSString *postString = [NSString stringWithFormat:@"Full_Name=%@&Email_Address=%@&Telephone_Number=%@&Your_Message=%@&AntiSpam=25",_fNameLabel.text, _emailLabel.text,_phoneLabel.text, _commentText.text];
NSData *data = [postString dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
[request setValue:[NSString stringWithFormat:@"%u", [data length]] forHTTPHeaderField:@"Content-Length"];
NSURLConnection *conn = [NSURLConnection connectionWithRequest:request delegate:self];
if(conn){
NSLog("Successfull!!");
}
此表单的目的是向我的帐户发送一封电子邮件,我已将其整合到安装此插件的表单中,但问题是我在运行测试应用程序时似乎没有收到电子邮件,并且当我输入值时,我还没有包含空格。
表格看起来像这样,