php - Log in with cURL and echo response with cookie -
i trying write "auto-login" script, uses curl log in specific site , echoing response, user can "bypass" login. (for example, grant one-time logins etc) obviously, using following method, cookie stored on server, not on client, in cookie.txt. i've tried setting $_cookie, won't work, since urls (actually subdomains) of auto-login script , service logged into, different. login works fine. see screen if logged in, clicking link requires login again. any ideas? thanks the code i've used auto-login: <?php $username="email@domain.com"; $password="password"; $url="http://sub.domain-to-login.com/index.php/sessions/login"; $cookie="cookie.txt"; $postdata = "email=".$username."&password=".$password.'&btn_login=login'; $ch = curl_init(); curl_setopt ($ch, curlopt_url, $url); curl_setopt ($ch, curlopt_ssl_verifypeer, false); curl_setopt ($ch, curlopt_useragent, ...