I do not get POST from "Checkout Cielo"?

1

I developed an e-commerce and used a payment system from Checkout Cielo with PHP. Every time a user makes a purchase the server of Cielo sends a POST to my PHP page informing the data of the purchase.

Here is an example of how I retrieve the data:

$var1 = $_POST['var1_cielo'];
$var2 = $_POST['var2_cielo'];

Everything was working normally, until I migrated the application to another server and now the POSTS always arrive empty.

By the tests I performed the problem is always with POST is done by another server to my site because the forms within the site are working normally.

    
asked by anonymous 25.02.2016 / 02:28

1 answer

1

User cURL , which is a library that allows < strong> HTTP requests :

$email = "[email protected]";
$nome = "Ríder Cantuária";

//todo o POST
$post = array("email"=>$email,"nome"=>$nome);

//server receptor
$url = "http://www.outroserver.com.br/receptor.php";

$curl = curl_init();

#leia a documentação em http://php.net/manual/pt_BR/function.curl-setopt.php 
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, 1);

/*Envelopa o Post*/
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);

curl_exec($curl); //executa
curl_close($curl); //fecha

From there, I get normal on the other server:

$_POST['nome']
$_POST['email']

Make this attempt if you fail to leave a comment.

    
25.02.2016 / 03:40