title: cURL returns 302, whereas a browser returns 200
body: <p>I have a script that uses a load of cURLs to log into a site and submit a series of forms, however this has recently stopped working due to the cURL requests returning 302s and redirecting to a block/endpoint page. If I do the same actions with a browser, I there are no redirects, just a 200 OK.</p>
  
  <p>My cURL is using the cookie returned by the login process, so I don't think that the session is being dropped.</p>
  
  <p>I'd originally thought that a CSRF Token (of some kind) was missing, given the redirect location, and that later forms in the process (using the browser) contain a hidden CSRF Token field, but the URL requires no posted data.</p>
  
  <p>The cURL and response are as follows:</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_URL, 'https://*******.********.co.uk/Dispatcher?menuid=pos_home'); 
  curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  curl_setopt($ch, CURLOPT_HEADER, 0);
  $content = curl_exec ($ch);
  echo "CURL INFO : &lt;BR/&gt;&lt;pre&gt;" ;
  print_r(curl_getinfo($ch));
  </code></pre>
  
  <p>which returns:</p>
  
  <pre><code>Array
  (
  [url] =&gt; https://*******.********.co.uk/Dispatcher?menuid=pos_home
  [content_type] =&gt; text/html
  [http_code] =&gt; 302
  [header_size] =&gt; 253
  [request_size] =&gt; 332
  [filetime] =&gt; -1
  [ssl_verify_result] =&gt; 20
  [redirect_count] =&gt; 0
  [total_time] =&gt; 0.142718
  [namelookup_time] =&gt; 2.4E-5
  [connect_time] =&gt; 2.4E-5
  [pretransfer_time] =&gt; 9.0E-5
  [size_upload] =&gt; 43
  [size_download] =&gt; 327
  [speed_download] =&gt; 2291
  [speed_upload] =&gt; 301
  [download_content_length] =&gt; -1
  [upload_content_length] =&gt; 43
  [starttransfer_time] =&gt; 0.142659
  [redirect_time] =&gt; 0
  [certinfo] =&gt; Array
      (
      )
  
  [primary_ip] =&gt; nnn.nnn.nnn.nn
  [primary_port] =&gt; 443
  [local_ip] =&gt; nnn.nnn.nnn.nn
  [local_port] =&gt; 53154
  [redirect_url] =&gt; https://*******.********.co.uk/Dispatcher?menuid=badorMissingCSRFT
  </code></pre>
  
  <p>)</p>
  
  <p>If anyone has any ideas why or how a server can give a different response for a cURL to a browser request, I'd be very grateful - thanks.of </p>