Strange redirecting problem when attempting to login using curl
<p>Trying to login using curl on this site: <a href="http://www.indianvideogamer.com" rel="nofollow">http://www.indianvideogamer.com</a>.</p>

<p>This is my complete script: </p>

<pre><code>        $ref = "http://www.indianvideogamer.com/" ;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,"http://www.indianvideogamer.com/forums/index.php?app=core&amp;amp;module=global&amp;amp;section=login&amp;amp;do=process") ;       // Target site
        curl_setopt ($ch, CURLOPT_COOKIEFILE, "C:/cookie2-techenclave.txt");             
        curl_setopt($ch, CURLOPT_COOKIEJAR, "C:/cookie2-techenclave.txt");
        curl_setopt($ch, CURLOPT_REFERER, $ref);  
        curl_setopt($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT);    // Timeout
        curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME); 
        curl_setopt ($ch, CURLOPT_POST, 1);
        curl_setopt ($ch, CURLOPT_POSTFIELDS, "referer=http://www.indianvideogamer.com/forums/index.php&amp;username=cute.bandar&amp;password=mypass");

      //  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);     // Follow redirects
        curl_setopt($ch, CURLOPT_MAXREDIRS, 4);             // Limit redirections to four
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);     // Return in string  


        $webpage['FILE'] = curl_exec($ch);

        curl_close($ch);
         echo $webpage['FILE'] ;
</code></pre>

<p>the result of running this script on localhost/script.php is that instead of echoing the page it redirects to <a href="http://www.localhost/script.php" rel="nofollow">http://www.localhost/script.php</a> . Why ?  </p>
