Advertisement
yesamarcos

Integração com API boletobancario

Apr 18th, 2019
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. <?php
  2.  
  3. echo "https://www.boletobancario.com/boletofacil/integration/api/v1/issue-charge?token=8D1472F01E481CE419FF94CB8C89625A322C721CAE91026AED573B741CFE60FD&description=2019041822003&amount=43.30&payerName=Marcos+Vinicius+Nascimento+Pereira&payerCpfCnpj=02039326170&payerEmail=mvnpereira@gmail.com".htmlentities('&notifyPayer')."=true".htmlentities('&notificationUrl')."=https://www.tecidosfabricart.com.br/index.php?option=com_boletofacilnotificacao&responseType=json&paymentTypes=BOLETO";
  4.  
  5. $ch = curl_init();
  6. $options = array(
  7. CURLOPT_URL => "https://www.boletobancario.com/boletofacil/integration/api/v1/issue-charge?token=8D1472F01E481CE419FF94CB8C89625A322C721CAE91026AED573B741CFE60FD&description=2019041822003&amount=43.30&payerName=Marcos+Vinicius+Nascimento+Pereira&payerCpfCnpj=02039326170&payerEmail=mvnpereira@gmail.com".htmlentities('&notifyPayer')."=true".htmlentities('&notificationUrl')."=https://www.tecidosfabricart.com.br/index.php?option=com_boletofacilnotificacao&responseType=json&paymentTypes=BOLETO",
  8. CURLOPT_SSL_VERIFYPEER => false,
  9. CURLOPT_ENCODING => 'UTF-8',
  10. CURLOPT_POST => true,
  11. CURLOPT_RETURNTRANSFER => true,
  12. // CURLOPT_POSTFIELDS => $data,
  13. );
  14. curl_setopt_array($ch, $options);
  15. $response = curl_exec($ch);
  16. curl_close($ch);
  17.  
  18. $resultado = json_decode($response);
  19.  
  20. echo "<h1>Informações</h1>";
  21. echo "<h1>----------------</h1>";
  22. echo "<a href='https://www.boletobancario.com/boletofacil/integration/api/v1/issue-charge?token=8D1472F01E481CE419FF94CB8C89625A322C721CAE91026AED573B741CFE60FD&description=2019041822003&amount=43.30&payerName=Marcos+Vinicius+Nascimento+Pereira&payerCpfCnpj=02039326170&payerEmail=mvnpereira@gmail.com".htmlentities('&notifyPayer')."=true".htmlentities('&notificationUrl')."=https://www.tecidosfabricart.com.br/index.php?option=com_boletofacilnotificacao&responseType=json&paymentTypes=BOLETO' target='_blank'>Json Retornando ao acessar a URL direto.</a> mas não está funcionando com o CURL";
  23.  
  24. echo "<pre>"; print_r($response); echo "</pre>";
  25. echo "<pre>"; print_r($resultado); echo "</pre>";
  26.  
  27. $code = $resultado->data->charges[0]->code;
  28. $link = $resultado->data->charges[0]->link;
  29. $checkout = $resultado->data->charges[0]->checkoutUrl;
  30.  
  31. echo "<pre>"; print_r($code);
  32. echo "<pre>"; print_r($link);
  33. echo "<pre>"; print_r($checkout);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement