title: how can i fix this login with curl
body: <p>I try to login to this website with curl but it didn't work 
  when I change the curl_get url at the bottom to the same curl post url then I see the login page and when I change it to another page I get error message.
  So how can I login with curl?
  This information (email and password) is real account so you can test it directly.</p>
  
  <pre><code>&lt;?php
  
  define('USERNAME', 'anmeldungtest@hotmail.com');
  define('PASSWORD', 'lolo2019');
  define('SUBMIT', 'sign in');
  define('USER_AGENT', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0');
  define('COOKIE_FILE', 'C:\xampp\cookies.txt');//Where our cookie information will be stored (needed for authentication).
  define('LOGIN_FORM_URL', 'https://app.pipedrive.com/auth/login');
  define('LOGIN_ACTION_URL', 'https://app.pipedrive.com/auth/login');//Login action URL. Sometimes, this is the same URL as the login form.
  
  
  $postValues = array(
      'login' =&gt; USERNAME,
      'password' =&gt; PASSWORD
  );
  
  
  $curl = curl_init();
  
  curl_setopt($curl, CURLOPT_URL, LOGIN_ACTION_URL);
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postValues));
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);//We don't want any HTTPS errors.
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($curl, CURLOPT_COOKIEJAR, COOKIE_FILE);//Where our cookie details are saved. This is typically required for authentication, as the session ID is usually saved in the cookie file.
  curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT);//Sets the user agent. Some websites will attempt to block bot user agents. Hence the reason I gave it a Chrome user agent.
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);//Tells cURL to return the output once the request has been executed.
  curl_setopt($curl, CURLOPT_REFERER, LOGIN_FORM_URL);//Allows us to set the referer header. In this particular case, we are fooling the server into thinking that we were referred by the login form.
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); //Do we want to follow any redirects?
  curl_exec($curl);
  
  
  if(curl_errno($curl)){
      throw new Exception(curl_error($curl));
  }
  
  //CURL GET url
  
  //curl_setopt($curl, CURLOPT_URL, 'https://kad-fa7a1e.pipedrive.com/pipeline');
  curl_setopt($curl, CURLOPT_URL, 'https://app.pipedrive.com/auth/login');
  curl_setopt($curl, CURLOPT_COOKIEJAR, COOKIE_FILE);
  curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT);
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  
  
  echo curl_exec($curl);
  </code></pre>