title: Curl error: Maximum (20) redirects followed
body: <p>While trying to CURL to myntra it's giving error. I am trying to get extract details by DOMDOCUMENT, but it's giving the same error:</p>
  
  <blockquote>
    <p>Maximum (20) redirects followed</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php
          $url = 'http://www.myntra.com/sports-shoes/nike/nike-men-black-dart-12-msl-running-shoes/1547908/buy?src=search&amp;uq=false&amp;q=nike&amp;p=1';
          $ch  = curl_init($url);
          //curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)");
          curl_setopt($ch, CURLOPT_AUTOREFERER, true);
          curl_setopt($ch, CURLOPT_HEADER, 1);
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_FAILONERROR, true);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Cookie: test=cookie"));
  
          $cl  = curl_exec($ch);
          if(curl_exec($ch) === false)
          {
                  echo 'Curl error: ' . curl_error($ch);
                  echo 'Curl error: ' . curl_errorno($ch);
          }else{
             $dom = new DOMDocument();
             $xpath = new DOMXpath($dom);
             print_r($xpath);            
          }
  ?&gt;
  </code></pre>