PHP CURL sending POST to Django app issue
Posted
by Felipe Pelá
on Stack Overflow
See other posts from Stack Overflow
or by Felipe Pelá
Published on 2010-06-08T20:40:49Z
Indexed on
2010/06/08
20:42 UTC
Read the original article
Hit count: 195
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.
© Stack Overflow or respective owner