graham23s Posted November 5, 2008 Share Posted November 5, 2008 Hi Guys, i am trying to automatically loginto my webmail using curl, i have my code like: <?php $id = "xxxx"; $pw = "xxxxxx"; $postfields = "login_username=$id&secretkey=$pw&submit=Login"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 1); // Get the header curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection curl_setopt($ch, CURLOPT_COOKIEJAR, "curl/cookie.txt"); curl_setopt($ch, CURLOPT_URL, "http://webmail.website.co.uk/src/login.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "$postfields"); curl_exec($ch); curl_close($ch); print_r($ch); print("<iframe width=\"95%\" height=\"700px\" scrolling=\"auto\" frameborder=\"1\" bordercolor=\"#000000\" src=\"$ch\"></iframe><br /><br />"); ?> all this seems to do ius diaplay me the page not logged in! i have edited out the site name am i doing something wrong at all? thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/131533-curl-and-login/ Share on other sites More sharing options...
flyhoney Posted November 5, 2008 Share Posted November 5, 2008 I would use something like Firebug or the Web Developer Toolbar in Firefox to take a look at the request headers and verify that everything working correctly. Link to comment https://forums.phpfreaks.com/topic/131533-curl-and-login/#findComment-683174 Share on other sites More sharing options...
rhodesa Posted November 5, 2008 Share Posted November 5, 2008 by using CURL, you are authenticating and starting a session from your server to the webmail...the iframe that you print after is for your browser to the webmail (which is a different session). i would recommend something like Greasemonkey if you are trying to auto-authenticate yourself Link to comment https://forums.phpfreaks.com/topic/131533-curl-and-login/#findComment-683182 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.