Hi,
Curl: problem with POST on Redirecting
session tracking problem with curl
I am facing the problem to use post variables on my CURL request page. I want to login on aonther site page from my site. the code i am using is:-
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://localhost/techbuys/adminsite/index.php");
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3); //times out after 4s
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "txtLogin=login&txtNickName=test&txtPassword=test");
$result=curl_exec ($ch);
curl_close ($ch);
echo ($result);
The Other site receive the form data in th index.php and proces them and then redirect the page to main.php but this does not happen in my code. Please let me know how can i also go to main.php page by using above code. Also if the main.php page have any session set then how can i handle it and if the login page have Secure Socket Layer then how can i post variables to access the main.php page?
Regards,
Imran Khalid
imranlink@hotmail.com
wazirabad@yahoo.com