See also
CURL, Client Url Library Functions in the php documentation.
Following are 2 examples on how you can use cURL to POST data. The first one builds a string, like a url string. The second one posts the variables from an array. The latter can be used when you (in your POST processing script) just assign the $_POST array to your array.
1. Post a url-like stream
[php]
<?php
// POST a stream via cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/tester.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"postvar1=value1&postvar2=value2&postvar3=value3") ;
curl_exec ($ch);
curl_close ($ch);
?>
[/php]2. Here you POST an array (like you have) via cURL[php]
<?php
// ------------ POST an array via curl -----------------------
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://path/to/your/page.php");
$id=111; $code='ABCD';
// Build the test array
$data=array( 'id'=>$id, 'code'=>'$code');
// Do a POST
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// grab URL, and print
curl_exec($ch);
?>[/php]Ronald