I am calling a login script on the server using http call from iphone. the script returns a string "Invalid" or "valid" based on given username/pswd.
Here is what I am using:
NSString *myurlstr = [[NSString alloc] initWithFormat:@"http://www.mysite.com/iph/login.aspx?username=%@&password=%@",uname,pswd]; NSString *resultstr = [NSString stringWithContentsOfURL:[NSURL URLWithString:myurlstr] encoding:NSUTF8StringEncoding error:&error];
NSLog(@"HERE IS THE ONE: %@",resultstr);
Here is what the Console log prints:
TestingTrying[51514:207] HERE IS THE ONE: Invalid Login/Password
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
html xmlns="http://www.w3.org/1999/xhtml" >
head>title> Untitled Page
/title>/head>
body>
form name="form1" method="post" action="login.aspx?username=abc&password=abc" id="form1">
input type="hidden" name="_VIEWSTATE" id="_VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGTnVSKZt+HQfSlQeCketelC9X+47A==" />
div>
/div> /form> /body> /html>
Can someone help on how to get the string only(Invalid Login/Password) and not the content that starts from DOCTYPE onwards?