Torflu Posted August 1, 2009 Share Posted August 1, 2009 Well I am trying to take a second approach,to stay logged in by copying the cookie.I am trying to scrape the news and mail it,for it i need to be logged in.My earlier thread's link - http://www.phpfreaks.com/forums/index.php/topic,262923.0.html.When i see my cookie details,using an addon in mozilla i see following details. Name : pass Value : 1223b8c30a347321299611f873b449ad Domain/Path : www.xx.org/ Expires : Tuesday, January 19, 2038 7:44:33 AM Name : uid Value : 1028666 Domain/Path : www.xx.org/ Expires : Tuesday, January 19, 2038 7:44:33 AM I am trying with the following code <? $value = "1223b8c30a347321299611f873b449ad"; $uid= "1028666"; setcookie("pass", $value, time()+3600*24*1000,"www.xx.org"); setcookie("uid", $uid, time()+3600*24*1000,"www.xx.org"); $open = file_get_contents('http://www.xx.org/browse.php'); echo $open; ?> I am getting 2 errors Warning: Cannot modify header information - headers already sent by (output started at C:\Users\Nuv\AppData\Roaming\NuSphere\PhpED\projects\pt.php5:2) in C:\Users\xx\AppData\Roaming\NuSphere\PhpED\projects\pt.php5 on line 5 Warning: Cannot modify header information - headers already sent by (output started at C:\Users\Nuv\AppData\Roaming\NuSphere\PhpED\projects\pt.php5:2) in C:\Users\xx\AppData\Roaming\NuSphere\PhpED\projects\pt.php5 on line 6 Can someone,please help me with my code and if it will work ? Link to comment https://forums.phpfreaks.com/topic/168363-copying-a-cookie-to-stay-logged-in/ Share on other sites More sharing options...
phpknight Posted August 1, 2009 Share Posted August 1, 2009 You can't send anything--not even whitespace--to the browser before you set a cookie. That is always the problem. It is happening somewhere. Link to comment https://forums.phpfreaks.com/topic/168363-copying-a-cookie-to-stay-logged-in/#findComment-888134 Share on other sites More sharing options...
trq Posted August 1, 2009 Share Posted August 1, 2009 Sorry, but your post and code make little sense. Are you trying to set a cookie related www.xx.org? Because the code you have creates a cookie related to YOUR server. Link to comment https://forums.phpfreaks.com/topic/168363-copying-a-cookie-to-stay-logged-in/#findComment-888136 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.