I am sending data to webserver in the Querystrings by creating URL dynamically. When I view that URl in UIAlertView it shows me correct one.
And when i try to get response using NSURL code, it does not respond.
Below is the code.
NSString *uu = @"http://www.zenhomeenergy.com/ZenIphoneServUpdate.aspx?CustomerID=11&FirstName=Rob&LastName=O'Connell&State=VIC&Street=4 Southey Street Brighton&PostCode=3186&Email=rob@rob.com&Mobile=04545455454&HomePhone=54545545545&WorkPhone=787878787878&PrimaryResidence=False&HomeOwner=True";
NSString *text = [NSString stringWithContentsOfURL:[NSURL URLWithString:uu]];
if(text) {
if([text isEqualToString:@"Success."]) {
textView.text = [textView.text stringByAppendingString:@"Success.\n"];
} else {
textView.text = [textView.text stringByAppendingString:@"Failed.\n"];
}
}
If you try putting the above URL into browser it says “Success.”
But the code above does not work.
OR if you have another easier way of sending data please tell me that as well.
Please Help.
You can try this:
It’s possible some of the characters in the string are screwing up the request because they aren’t legal URL characters, that function is meant to solve that problem but I’ve found it not to work in the past so I’ve actually been using this function:
}
good luck!