title: curl redirect not properly working
body: <p>My function is supposed to get the destination URL of $url:</p>
  
  <pre><code>function getUrl($url)
  {
      $user_agent='Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
      $ch = curl_init(); 
      $timeout = 10; // set to zero for no timeout 
      curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 
      curl_setopt ($ch, CURLOPT_URL, $url); 
      curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
      curl_setopt ($ch, CURLOPT_HEADER, 1);
      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
      curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
      $curl = curl_exec($ch);
      $header = curl_getinfo($ch);
      curl_close($ch); 
      return $header;
  
  }
  
  function get_url_list() {
  
   $url = "http://www.webliste.ch/click.aspx?nr=148252";
   $result=getUrl($url);
   print_r($result);echo "&lt;br&gt;";
  }
  
  get_url_list();
  </code></pre>
  
  <p>This results in the following:</p>
  
  <pre><code>Array
  (
      [url] =&gt; http://www.webliste.ch/click.aspx?nr=148252
      [content_type] =&gt; text/html; charset=iso-8859-1
      [http_code] =&gt; 200
      [header_size] =&gt; 320
      [request_size] =&gt; 139
      ...
      [redirect_time] =&gt; 0
      [certinfo] =&gt; Array
          (
          )
  
      [redirect_url] =&gt; 
  )
  </code></pre>
  
  <p>I am at a loss, because the URL is redirecting, and if I echo $ch, I get the redirected website.</p>
  
  <p>Anyone know what's the cause of this?</p>
  
  <p>The following doesnt work either:</p>
  
  <pre><code>$final_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
  </code></pre>
  
  <p>The output is the same as $result['url'], which is not what I am looking for.</p>