I had a similar need for one of my scripts, and I was able to do this using the following,
$url = URL_TO_RECEIVING_PHP; $fields = array( 'PARAM1'=>$_POST['PARAM1'], 'PARAM2'=>$_POST['PARAM2'] ); $postvars=''; $sep=''; foreach($fields as $key=>$value) { $postvars.= $sep.urlencode($key).'='.urlencode($value); $sep='&'; } $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$postvars); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $result = curl_exec($ch); curl_close($ch); echo $result;
It will display what is returned from your receiving PHP.
source share