将php变量从一个服务器转移到另一个服

I have a contact form which post the input to a .php file located in my server.
some of the code:

$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message_field = $_POST['message'];

In my server I can't use php mail(), so I want to transfer this variables to another .php file located in other domain.

I know I can do it directly in the form

action="http://otherdomain.com/contact.php"

but I want the php script to be on my server and "Behind the scenes" transfer the variables. My first question is if it possible to do so in this way? and the second, how to...

You will want to use CURL

$url = 'http://www.otherdomain.com/contact.php';
$fields_string = http_build_query($_POST);

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($_POST));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

You can send the post request using file_get_contents() (for example) :

// example data
$data = array(
   'foo'=>'bar',
   'baz'=>'boom',
);

// build post body
$body = http_build_query($data); // foo=bar&baz=boom

// options, headers and body for the request
$opts = array(
  'http'=>array(
    'method'=>"POST",
    'header'=>"Accept-language: en
",
    'data' => $body
  )
);

// create request context
$context = stream_context_create($opts);

// do request    
$response = file_get_contents('http://other.server/', false, $context)