0

I'm currently working with objective-c and have run in to a problem concerning javascript. I am connecting to a website through an iphone app and my goal is to login to a html form (Login.jsp)

<label class="login_label">Username</label>
     <input autocomplete="off" type="text" value="" name="ssusername" size="20" maxlength="50" />

     <label class="login_label">Password</label>
     <input autocomplete="off" type="password" name="sspassword" size="20" maxlength="20" value=""/>

I am trying to make a NSUrlConnection to this site in objective-c but the concern is this: If I enter

 https://www.login.com/Login.jsp?ssusername=%@&sspassword=%@, username.text, password.text 

It will only enter the enter the password in the html form. And when I look at the javascript I suspect it has something to do with the value in the username html code being value=""

My question: Is it possible to, without changing the html code (as I don't have access to it) make a NSUrlConnection passing username and password and retrieving the answer from this html form, or if anyone know why the username wont show when the adress is entered as above?

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
Pierre
  • 160
  • 2
  • 11
  • can you show full HTML form code instead of label ? What is the action method ? Post or GET method ? https://www.login.com/Login.jsp?ssusername=%@&sspassword=%@ is only for get method. Need to more detail of your HTML form method. – saturngod Apr 15 '13 at 06:00

2 Answers2

0

I think, login method may use POST method and your NSURLConnection is using get method.

You can check at POST with NSURLConnection - NO JSON.

Community
  • 1
  • 1
saturngod
  • 24,649
  • 17
  • 62
  • 87
0

It depends on server side. You can't really change input field value via GET parameters -- it's server-side job. You can execute JS code to enter username and password and then click login button via UIWebView's stringByEvaluatingJavaScriptFromString function or you can check this site/server documentation for some authentication methods and then use them (like @saturngod suggested).

folex
  • 5,122
  • 1
  • 28
  • 48