title: Curl giving unauthorized response in production but not in localhost
body: <p>I am using Curl to get contents of a website but I'm getting a <code>403 access denied</code> response on production. However, on my local machine (localhost), it works fine.</p>
  
  <p>I'm essentially using Curl to login to a website and then access the content after login.</p>
  
  <p>I think it has something to do with setting headers but I'm not quite sure, since the headers work on localhost.</p>
  
  <p>Here's my code for the curl request:</p>
  
  <pre><code>    $email = "email@example.com";
      $password = "password";
      $ch = curl_init();
      $options = [
          CURLOPT_URL  =&gt; 'https://auth.example.com/ajax/',
          CURLOPT_POST =&gt; 1,
  
          CURLOPT_POSTFIELDS     =&gt; "email=$email&amp;password=$password",
          CURLOPT_HTTPHEADER     =&gt; ['Content-Type: application/x-www-form-urlencoded'],
          CURLOPT_FOLLOWLOCATION =&gt; true,
          CURLOPT_HEADER         =&gt; 0,
          CURLOPT_REFERER        =&gt; 'https://my-website.com',
          CURLOPT_COOKIEFILE     =&gt; dirname(__FILE__) . '/cookie.txt',
          CURLOPT_USERAGENT      =&gt; 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2117.157 Safari/537.36',
          CURLOPT_COOKIEJAR      =&gt; dirname(__FILE__) . '/cookie.txt',
          CURLOPT_RETURNTRANSFER =&gt; true,
  
      ];
  
      curl_setopt_array($ch, $options);
  
      curl_exec($ch);
  
      //change URL
      curl_setopt($ch, CURLOPT_URL, "https://example.com/logged-in");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $content = curl_exec($ch);
  
      // do stuff with content
  </code></pre>
  
  <p>I'm also very interested in how this works in localhost and not in production.</p>
  
  <p>Any help is greatly appreciated!</p>