Encountered a problem on posting comment back to a comment box.
post not showing up, there is no error or whatsoever to check.
EDIT: Correct Answer
-(void)postToBoard
{
NSString *post = @"author=Jos&email=mail@domain.com.au&url=&comment=score+99.&submit=Post+Comment&comment_post_ID=1&comment_post_ID=1&comment_parent=0";
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSString *URLString = @"http://site.com.au/?p=1";
NSURL *postURL = [NSURL URLWithString:URLString];
[request setURL:postURL];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
//[request setValue:@"wp-comments-post.php" forHTTPHeaderField:@"HTTP/1.1"];
[request setHTTPBody:postData];
//self.receivedData = [NSMutableData data];
self.postConnection = [NSURLConnection connectionWithRequest:request delegate:self];
}
This line looks wrong:
It should be:
I’m not sure what you’re supposed to do with “wp-comments-post.php”, should that perhaps be in the URL instead?