0

I am trying to login to a website programmically, and I ran into a strange bit of code, and I can't figure out how I should format my POST request to login. Here is the form

<fieldset>
    <form action="/user/login" class="form" id="login_form" method="post">
        <p><input autocomplete="off" autofocus="" name="user[username]" placeholder="username" type="text" /></p>
        <p><input name="user[password]" placeholder="password" type="password" /></p>
        <div class="has_checkbox"><div id="reme" name="reme" type="checkbox"></div>
        <div class="smallfont">remember me</div></div>
        <p><a href="#" id="forgot_password">Forgot password?</a></p>
        <p class="submit"><input class="red" name="submit" type="submit" value="Login"  /></p>
    </form>
</fieldset>
Natecat
  • 2,175
  • 1
  • 17
  • 20
  • Format the post request? What does that mean?? – meda May 17 '14 at 23:28
  • Like what data am I supposed to send to /user/login to get a valid response back. – Natecat May 17 '14 at 23:29
  • I would remove user[] from names and it should be fine, your /user/login script should check if pass is correct for username used and set some cookie/session variables, that's all – moped May 17 '14 at 23:30
  • _“Like what data am I supposed to send”_ – the same your browser would send – which you can easily find out yourself by looking at such a request using your browser’s developer tools …! – CBroe May 17 '14 at 23:32
  • Sorry if you didn't understand the question, but this is isn't my website. I am trying to log into it programically – Natecat May 17 '14 at 23:32
  • @CBroe Can you put this as an answer? It answers my question, so might as well accept it. – Natecat May 17 '14 at 23:39

2 Answers2

1

Like what data am I supposed to send

The same your browser would send – which you can easily find out yourself by looking at such a request using your browser’s developer tools.

CBroe
  • 91,630
  • 14
  • 92
  • 150
0

The problem may be due to same origin policy. see http://en.wikipedia.org/wiki/Same_origin_policy

Also pay attention to browser malfunctions while doing this. HTML Form POST Cross Domain

Community
  • 1
  • 1
Positivity
  • 5,406
  • 6
  • 41
  • 61