私はデータを送信しようとしている、またはウェブサイト上のフォームに見えるものを送信しようとしています。アクションは次の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!!");
}
このフォームの目的は、このプラグインのインストール時にフォームに統合したアカウントにメールを送信することですが、テストアプリを実行して入力するとメールが届かないようです値にはまだスペースを入れていません。
形はこんな感じで、