title: PHP cURL follow redirect and get result
body: <p>If you visit URL:</p>
  
  <p><a href="https://selfsolve.apple.com/agreementWarrantyDynamic.do?caller=sp&amp;sn=990002316140324" rel="nofollow">https://selfsolve.apple.com/agreementWarrantyDynamic.do?caller=sp&amp;sn=990002316140324</a></p>
  
  <p>then it will redirect and results will be shown at URL:</p>
  
  <p><a href="https://selfsolve.apple.com/wcResults.do" rel="nofollow">https://selfsolve.apple.com/wcResults.do</a></p>
  
  <p>I'm trying with PHP cURL to get this results but the page is empty. Its not redirecting.</p>
  
  <p>Here is my code which I tried: </p>
  
  <pre><code>&lt;?php 
  
  $url ='https://selfsolve.apple.com/agreementWarrantyDynamic.do?caller=sp&amp;sn=990002316140324';
  
  $http_headers = array(
                      'Accept: /*',
                      'Connection: keep-alive'
                    );
  
  $ch = curl_init();
  
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $http_headers);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)');
  curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/applecookie.txt');
  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
  
  $retValue = curl_exec($ch);
  $response = json_decode(curl_exec($ch));
  $ee       = curl_getinfo($ch);
  print_r($ee);
  
  print_r($retValue);
  ?&gt;
  </code></pre>
  
  <p>How to make it work?</p>