title: Login to site with curl in vBulletin
body: <p>I been trying to login to a site <a href="http://www.siamchart/forum" rel="nofollow noreferrer">(www.siamchart/forum)</a> by following instruction on this link.. <a href="https://stackoverflow.com/questions/3008817/login-to-remote-site-with-php-curl">Login to remote site with PHP cURL</a>. I cannot past through the login. After running the following script, it redirect me to the same login page (www.siamchart/forum) without successful login.</p>
  
  <p>My code is as following..</p>
  
  <pre><code>$username="ABC"; 
  $password="12345"; 
  $url="www.siamchart.com/forum/login.php?do=login"; 
  $cookie="siamchart_cookie.txt"; 
  
  $postdata = "vb_login_username=".$username."&amp;vb_login_password=".$password; 
  
  $ch = curl_init(); 
  curl_setopt ($ch, CURLOPT_URL, $url); 
  curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
  curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
  curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); 
  curl_setopt ($ch, CURLOPT_REFERER, $url); 
  
  curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
  curl_setopt ($ch, CURLOPT_POST, 1); 
  $result = curl_exec ($ch); 
  
  echo $result;  
  curl_close($ch);
  </code></pre>
  
  <h1>Edit</h1>
  
  <p>The forum is using vBulletin. This is the script in the login page</p>
  
  <pre><code>&lt;script type="text/javascript" src="clientscript/vbulletin_md5.js?v=4111"&gt;&lt;/script&gt;
     &lt;form id="navbar_loginform" action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)"&gt;
     &lt;fieldset id="logindetails" class="logindetails"&gt;
     &lt;div&gt;
       &lt;div&gt;
       &lt;input type="text" class="textbox default-value" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" /&gt;
       &lt;input type="password" class="textbox" tabindex="102" name="vb_login_password" id="navbar_password" size="10" /&gt;
       &lt;input type="text" class="textbox default-value" tabindex="102" name="vb_login_password_hint" id="navbar_password_hint" size="10" value="Password" style="display:none;" /&gt;
       &lt;input type="submit" class="loginbutton" tabindex="104" value="Log in" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" /&gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;/fieldset&gt;
     .
     .
  &lt;/script&gt;
  </code></pre>
  
  <p>Am I do anything wrong? Thank you very much.</p>