I need to send varibles POST received by a form in a server to another server I have a file that receives the varibles and groups them in an array like this:
$url = "http://servidor2.com/cotizador.php";
$datosProducto = array("modelo"=>htmlspecialchars($_GET["modelo"]), "fecha"=>$fecha, "nombre"=>htmlspecialchars($_POST["nombreCotizador"]), "email"=>htmlspecialchars($_POST["correoCotizador"]), "telefono"=>htmlspecialchars($_POST["telefonoCotizador"]), "mensaje"=>htmlspecialchars($_POST["mensajeCotizador"]));
$crm = curl_init();
curl_setopt ($crm, CURLOPT_URL, $url);
curl_setopt ($crm, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crm, CURLOPT_POST, 1);
curl_setopt ($crm, CURLOPT_POSTFIELDS, $datosProducto);
$respuesta = curl_exec($crm);
if ($respuesta === FALSE){
echo "Error: ".curl_error($crm);
}
curl_close($crm);
var_dump($respuesta);
And I have a file that should receive the array sent with Curl like this:
var_dump($_POST);
The problem is that the response in the send file shows the result as if the array had been sent, however in the receiver file it always shows an empty array.
I've been reviewing the internet for days and trying several options.
I appreciate your cooperation.