title: Login with php curl with token
body: <p>i'm trying to login to <a href="https://www.amzreviewtrader.com/" rel="nofollow">https://www.amzreviewtrader.com/</a> (thanks to <a href="https://www.amzreviewtrader.com/account.php" rel="nofollow">https://www.amzreviewtrader.com/account.php</a> page).
  I noticed that there is always a token whick will change every refresh. So with first curl i get it.
  After, i try to pass token, email and password with post method. but i can't login, i don't know why.</p>
  
  <pre><code>function grab_page($site){
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
          curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
          curl_setopt($ch, CURLOPT_TIMEOUT, 40);
          curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
          curl_setopt($ch, CURLOPT_URL, $site);
          ob_start();
          return curl_exec ($ch);
          ob_end_clean();
          curl_close ($ch);
      }
  
      function login($url){
  
      $get_token = curl_init($url);
        curl_setopt($get_token, CURLOPT_COOKIEJAR, "cookie.txt");
        curl_setopt($get_token, CURLOPT_COOKIEFILE, "cookie.txt");
        curl_setopt($get_token, CURLOPT_TIMEOUT, 40000);
        curl_setopt($get_token, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($get_token, CURLOPT_URL, $url);
        curl_setopt($get_token, CURLOPT_FOLLOWLOCATION, TRUE);
        $response = curl_exec($get_token);
        $html = str_get_html($response);
        $token = $html-&gt;find('div.col-xs-12 form.form-horizontal input')[0]-&gt;value;
        echo $token;
  
          $login = curl_init($url);
          curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
          curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
          curl_setopt($login, CURLOPT_TIMEOUT, 40000);
          curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE);
          curl_setopt($login, CURLOPT_URL, $url);
          curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE);
          curl_setopt($login, CURLOPT_POST, TRUE);
          curl_setopt($login, CURLOPT_POSTFIELDS, "account_token=".$token."&amp;email=xxxxxxxxx@xxxxx.xx&amp;password=xxxxxxx");
          return curl_exec ();
          curl_close ();
  
          grab_page("https://www.amzreviewtrader.com/product-list.php");
      }
  </code></pre>