iPhone: ASIFormDataRequest Returns NULL from PHP Server

Posted by meetS on Stack Overflow See other posts from Stack Overflow or by meetS
Published on 2010-04-18T03:10:50Z Indexed on 2010/04/18 14:23 UTC
Read the original article Hit count: 725

Hi,

I have PHP script link, which responds YES or NO when we set post userName and emailID. I have used ASI framework.

When I try to connect with the following code, I get a null return.

NSURL *url = [NSURL URLWithString:@"https://abc.com/abctest/registration.php"];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setPostValue:@"[email protected]" forKey:@"email"];
[request setPostValue:@"pqr" forKey:@"userName"];
[request start];
NSError *error = [request error];
if (!error) {
    NSString *response = [request responseString];
    printf("\n\n\n Responce %s",[response UTF8String]);
    response = [response stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    if ([response isEqualToString:@"YES"])
    {
       printf("\n\n YES");
    }
}

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsurlrequest