PagSeguro notification to account for Adwords conversion

0

I would like to perfect the conversion of Adwords.

Whenever the payment is approved, access the Adwords conversion for more control.

I have the following code:

<?php

$notificationCode = preg_replace('/[^[:alnum:]-]/','',$_POST["notificationCode"]);

$data['token'] ='MEUTOKEN';
$data['email'] = 'MEUEMAIL';

$data = http_build_query($data);

$url = 'https://ws.pagseguro.uol.com.br/v3/transactions/notifications/'.$notificationCode.'?'.$data;

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
$xml = curl_exec($curl);
curl_close($curl);

$xml = simplexml_load_string($xml);

$reference = $xml->reference;
$status = $xml->status;
$valor = $xml->netAmount

if ($reference = '3')
{

echo 'Código do Adwords de conversão';
exit;

}


?>

XML

A resposta do xml é: <status>3</status>

Is there something wrong with this?

    
asked by anonymous 24.08.2018 / 16:30

0 answers