CerealBH Posted February 16, 2009 Share Posted February 16, 2009 theres a site, that i can get curl to login, to then i want to navigate through there while still logged in i have added cookiejar but its still not working here is my code function loginpof($username, $password) { $postfields = "?username=" . urlencode($username); $postfields .= "&password=" . urlencode($password); $pof = "http://www.website.com/inbox.aspx".$postfields; $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt($ch, CURLOPT_URL, $pof); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close ($ch); return($result); } that is to login then i want to do this function search(){ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); curl_setopt($ch, CURLOPT_URL, "http://www.website.com/basicsearch.aspx"); $result = curl_exec($ch); curl_close($ch); return($result); } but it wont stay loggged in, any help? Link to comment https://forums.phpfreaks.com/topic/145356-php-cookiessession-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.