hi all
i am developing one app which will login to vonage website and do some functions like call froward etc . For that purpose first i am trying to login to vonage website
i did these steps
1) Found the login url of vonage
2) used livehttpheader addon to capture outgoing post request data when i clicked sigin
the data i found is
username=myusername&password=mypassword&redirectingURL=%2Fwebaccount%2Fdashboard%2Fchoose.htm&frontDoorLogin=&goToSelection=callforwarding&loginsubmit=Sign+In
after i got my data i started coding in xcode , i dont know what is best way to do it but i searched for sometime then i tried like this
-(IBAction) buttonpressed {
NSURL *url = [NSURL URLWithString:@"https://secure.vonage.com/vonage-web/public/login.htm"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setValue:@"myuser" forKey:@"username"];
[request setValue:@"mypass" forKey:@"password"];
[request setValue:@"/webaccount/dashboard/choose.htm" forKey:@"redirectingURL"];
[request setValue:@"" forKey:@"frontDoorLogin"];
[request setValue:@"callforwarding" forKey:@"goToSelection"];
[request setValue:@"Sign+In" forKey:@"loginsubmit"];
[request setDelegate:self];
[request startAsynchronous];
}
- (void)requestFinished:(ASIFormDataRequest *)request
{
// Use when fetching text data
NSString *responseString = [request responseString];
UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"Hmm" message:@"http works" delegate:self cancelButtonTitle:@"okay" otherButtonTitles:nil];
[alert show];
[alert release];
NSLog(@"Output = %@",responseString);
}
- (void)requestFailed:(ASIFormDataRequest *)request
{
NSError *error = [request error];
UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"fail" message:@"http fails" delegate:self cancelButtonTitle:@"okay" otherButtonTitles:nil];
[alert show];
[alert release];
}
but when i ran app in my simulator it crashed .
am i doing correct way in posting data ? and is there any other way to do this ?
can any one help me in this issue
i am using asihttprequest library
thanks in advance
regards
Edit : My blind mistake i types setvalue instead of setpostvalue ,this will solve this issue :)