title: Access CURLOPT_POSTFIELD vars in remote script?
body: <p>How do I retrieve the POSTFEILD var contents in the remote script (target_url.php) to use it within the same remote script?  </p>
  
  <p>I am doing something like this below.  It returns no errors.  </p>
  
  <pre><code>//Have tried multiple ways to setup the POSTFEILD argument, such as:
  
  $data = array('var'=&gt;'varcontents');
  $post_arg = http_build_query($data) . "\n";
  
  //and
  
  $post_arg = 'var ='  . urlencode($varcontents);
  
  
  //create cURL connection
  $ch = curl_init('http://www.remotedomain.com/target_url.php');
  
  //set options
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  
  //set data to be posted
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post_arg);
  
  //perform the request
  $result = curl_exec($ch);
  
  //show information regarding the request
  print_r(curl_getinfo($ch));
  echo curl_errno($ch) . '-' . curl_error($ch);
  </code></pre>