I am developing a form in which you want to send the collected data to a third-party website in the form: http://www.domain.com/page?key=value&key2=value2
I decided to use cURL because I did not find an alternative that convinced me.
The problem that I run is that after submitting the form, cURL is executed, but I am redirected to the domain I specified. Instead, I want to redirect the user to a confirmation page in my domain, and not to a third-party website.
Here is an example of the code I'm using:
$URL="otherserver.domain.com"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://$URL"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "key=value2&key2=value2&key3=value3"); curl_exec($ch); $info = curl_getinfo($ch); curl_close ($ch);
How can I prevent a redirect to othererver.domain.com?
Please feel free to let me know if you think that instead of using cURL there is a better way to send data to a third-party website.
Thanks to everyone in advance.
Ole media
source share