PHP CURL sending POST to Django app issue
- by Felipe Pelá
This code in PHP sends a HTTP POST to a Django app using CURL lib.
I need that this code sends POST but redirect to the page in the same submit. Like a simple form does.
The PHP Code:
$c = curl_init();
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_URL, "http://www.xxx.com");
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, 'Var='.$var);
curl_exec($c);
curl_close ($c);
In this case, the PHP is sending the HTTP POST, but is not redirecting to the page. He is printing the result. My URL still .php and not a django/url/
I need be redirected to the django URL with the Post like a simple form in HTML does.
Any Idea?
Thanks.