title: POSTing Form Data and Storing Cookie File with PHP Curl
body: <pre><code>$process = curl_init();
  
  $temporary_cookie_file = 'temporaryfiles/'.strtolower($user_general_information['Username']).'_cookies.txt';
  $temporary_cookie_file_handler = fopen($temporary_cookie_file, 'w');
  fclose($temporary_cookie_file_handler);
  
  $user_data = array('TCNK'=&gt;'authenticationEntryComponent', 'submitEvent'=&gt;'1', 'guestLoginEvent'=&gt;'', 'enterClicked'=&gt;'true', 'bscf'=&gt;'', 'bscv'=&gt;'', 'targetEntid'=&gt;'', 'ajaxSupported'=&gt;'yes', 'screenName'=&gt;$user_general_information['Username'], 'kclq'=&gt;$user_general_information['Password']);
  
  curl_setopt($process, CURLOPT_URL, 'https://www.edline.net/post/InterstitialLogin.page');
  curl_setopt($process, CURLOPT_USERAGENT, 'Chrome/12.0.742.122');
  curl_setopt($session, CURLOPT_POST, true);
  curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($user_data));
  curl_setopt($process, CURLOPT_TIMEOUT, 0);
  curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($process, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($process, CURLOPT_COOKIEJAR, realpath($temporary_cookie_file));
  curl_setopt($process, CURLOPT_COOKIEFILE, realpath($temporary_cookie_file));
  curl_setopt($process, CURLOPT_HEADER, false);
  $results_1 = curl_exec($process);
  
  var_dump($results_1);
  die();
  </code></pre>
  
  <p>I am trying to use POST form data to log into a site and then store the created cookies in a temporary file. I've looked at other discussions that talk about doing this and did as them but it doesn't work. When I try, it simply refreshes the page with no changes. I've been working on this for hours...Any ideas of what I am doing wrong?</p>