If you want to do this on your server (i.e. you want your server to act as a proxy server), you can use cURL to do this.
extract($_POST);
$url = 'http://domain.com/get-post.php';
$fields_string = "";
$fields = array(
'lname'=>urlencode($last_name),
'fname'=>urlencode($first_name)
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
$fields_string = rtrim($fields_string,'&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$result = curl_exec($ch);
curl_close($ch);
However, if you just want to send a POST request to another server, you can simply change the attribute action:
<form action="http://some-other-server.com" method="POST">
source
share