Url of a POST request

Asked

Viewed 155 times

0

Hello, good(a) day/afternoon/night!

I am developing a plugin to generate billets in Woocommerce, in case I need to send the data of a form to the bank in order to get the billet and display to the customer.

I chose to do this using PHP-Curl, which I thought was the best option. Well, I was able to send the form data via POST and receive the boleto, but there is one last thing missing, the URL generated by the bank, which is necessary to print a duplicate of the boleto, if necessary.

They know to inform me if it is possible to "catch" this URL with the Curl?

Follow my current code, if it helps

$fields = array com os dados do formulário

$url = 'https://geraboleto.sicoobnet.com.br/geradorBoleto/GerarBoleto.do';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

$result = curl_exec($ch); 

curl_close($ch);
  • Welcome Rodrigo, bring more details in the question, for example how comes this database url, if you already have a query returning.

  • @Andrélins, actually the database sent me only an html form, so I know the name property of the <inputs> I used in the $Fields array, and the $url I am using the form action property url. Unfortunately this is all I have to work with.

  • Maybe you can use curl_getinfo to get some information. I found this link for the documentation: https://www.php.net/manual/en/function.curl-getinfo.php

  • own curl_exec already brings a response from the server, which in this case, you stored in $result. Give a var_dump in $result and see if this information has been returned to you

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.