title: Login and Logout in curl?
body: <p>I login to my account with this code.
      http://www.mywebsite.com/login.php'; </p>
  
  <pre><code>$postVars = 'username=myuser&amp;password=1234'; 
  $tmpfname = 'cookie.txt'; 
  $page = '/login.php'; 
  $headers = array( 
          "POST ".$page." HTTP/1.1", 
          "Content-Type: application/x-www-form-urlencoded; charset=UTF-8", 
          "Accept: */*", 
          "Accept-Language: en-US,en;q=0.5", 
          "Cache-Control: no-cache", 
          "Referer: http://www.mywebsite.com/", 
          "Content-length: ".strlen($postVars), 
          "Pragma: no-cache", 
          "Connection: keep-alive", 
          "X-Requested-With: XMLHttpRequest", 
          "Cache-Control: no-cache" 
      ); 
  
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt($ch, CURLOPT_URL, $url); 
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
  curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0'); 
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
  curl_setopt($ch, CURLOPT_POST, 1); 
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postVars); 
  curl_setopt($ch, CURLOPT_COOKIEJAR, $tmpfname); 
  curl_setopt($ch, CURLOPT_COOKIEFILE, $tmpfname); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
  $run = curl_exec($ch); 
  $info = curl_getinfo($ch); 
  
  curl_close($ch);
  
  ?&gt;
  </code></pre>
  
  <p>After Login,I want to visit <a href="http://mywebsite.com/profile.php" rel="nofollow">http://mywebsite.com/profile.php</a> and <a href="http://example.com/home.php,and" rel="nofollow">http://example.com/home.php,and</a> Logout by visiting <a href="http://mywebsite.com/logout.php" rel="nofollow">http://mywebsite.com/logout.php</a></p>
  
  <p>What should I do? Do you have an example?</p>