title: how can i set cookie in curl
body: <p>i am fetching somesite page..</p>
  
  <p>but it display nothing
  and url address change.</p>
  
  <p>example i have typed</p>
  
  <p><a href="http://localhost/sushant/EXAMPLE_ROUGH/curl.php" rel="nofollow noreferrer">http://localhost/sushant/EXAMPLE_ROUGH/curl.php</a></p>
  
  <p>in curl page my coding is=</p>
  
  <pre><code>$fp = fopen("cookie.txt", "w");
  
  fclose($fp);
  
  $agent= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0';
  
  $ch = curl_init();
  
  curl_setopt($ch, CURLOPT_USERAGENT, $agent);
   // 2. set the options, including the url  
  
  curl_setopt($ch, CURLOPT_URL, "http://www.fnacspectacles.com/place-spectacle/manifestation/Grand-spectacle-LE-ROI-LION-ROI4.htm");  
  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
  
  curl_setopt($ch, CURLOPT_HEADER, 0);  
  
  curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  
  curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  // 3. execute and fetch the resulting HTML output  
  
  if(curl_exec($ch) === false)
  {
    echo 'Curl error: ' . curl_error($ch);
  }
  else
    echo $output = curl_exec($ch);  
  
   // 4. free up the curl handle  
  curl_close($ch); 
  </code></pre>
  
  <p>but it canege url like this..</p>
  
  <p><a href="http://localhost/aide.do?sht=_aide_cookies_" rel="nofollow noreferrer">http://localhost/aide.do?sht=_aide_cookies_</a></p>
  
  <p>object not  found.</p>
  
  <p>how can solve these problem help me</p>