title: Automatic Website Login using cURL
body: <p>Hey all. I've been looking for a while for something that can help me out with this.</p>
  
  <p>I'm writing a script that will login to Gamefly.com, and add 50 games to my queue. The queue part works fine enough, but the login simply won't work. I've read about using cURL before, and I noticed that PHP has a decent enough time with it. So here's what I've come up with:</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://www.gamefly.com/member/logon/?ReturnUrl=http%3a%2f%2fwww.gamefly.com%2f');
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, 'ctl00$ctl00$ctl00$MainContent$MainContent$MainContent$LoginForm$emailAddress=xxxx@xxxx.com&amp;ctl00$ctl00$ctl00$MainContent$MainContent$MainContent$LoginForm$password=xxxx');
  curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
  $test = curl_exec($ch);
  </code></pre>
  
  <p>Obviously, I think I'm getting the wrong fields when I do this. Does anyone have any ideas on how I can get it to login, or am I boned? Thanks.</p>