Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $email = 'seu email cadastrado no pagseguro';
- $token = 'seu token';
- $url = 'https://ws.pagseguro.uol.com.br/v2/checkout/?email=' . $email . '&token=' . $token;
- $xml = '<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
- <checkout>
- <currency>BRL</currency>
- <redirectURL>http://www.minhaloja.com.br/paginaDeRedirecionamento</redirectURL>
- <items>
- <item>
- <id>1</id>
- <description>1000 Cash</description>
- <amount>1.00</amount>
- <quantity>1</quantity>
- <weight>1000</weight>
- </item>
- </items>
- <reference>REF_1</reference>
- <sender>
- <name>Caio Henrique</name>
- <email>caio_bnh22@hotmail.com</email>
- <phone>
- <areaCode>21</areaCode>
- <number>00000000</number>
- </phone>
- </sender>
- </checkout>';
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_HTTPHEADER, Array('Content-Type: application/xml; charset=ISO-8859-1'));
- curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
- $xml= curl_exec($curl);
- curl_close($curl);
- $xml= simplexml_load_string($xml);
- $result = sprintf("https://pagseguro.uol.com.br/v2/checkout/payment.html?code=%s", $xml -> code);
- echo "<a href='$result'>Comprar 1000 Cash</a>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement