url - POST request for login page -


i creating app site , have problem signin. have login page login , pass fields , "login" button.

i tried write post request (you can see below) sign in, doesn't work.

please, give me solutions.

i've been coding in obj-c few weeks , don't many things.

nsstring *login = loginfield.text; nsstring *password = passfield.text;    nsurl *theurl = [nsurl urlwithstring:[nsstring stringwithformat:@"http://mysite",login, password]]; //here place url link  nsurlrequest *req = [nsurlrequest requestwithurl:theurl]; nsurlconnection *connection = [nsurlconnection connectionwithrequest:req delegate:self]; if (connection) {     nslog(@"connection successful"); } else {     nslog(@"failed"); } 

nsurlrequest httpmethod default "get" , need set "post" in code.
example shows nsmutableurlrequest because have had code tested in application. should able same nsurlrequest if prefer that.

nsmutableurlrequest *req = [[nsmutableurlrequest alloc] init]; [req seturl:[nsurl urlwithstring:theurl]]; [req sethttpmethod:@"post"]; 

hope helps.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -