我试图向网站上的表单发送数据或看起来像什么,操作是这样的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!!");
}
此表单的目的是向我的帐户发送一封电子邮件,我在安装此插件时将其集成到表单中,但问题是当我运行我的测试应用程序和输入时我似乎没有收到电子邮件值我还不包括空格。
表格看起来像这样,