adiya Posted April 10, 2015 Share Posted April 10, 2015 I have two domains - http://domaina.com, http://domainb.com I'm calling domainb.com's url from domaina.com: file_get_contents('http://domainb.com/a.php'); In http://domainb.com/a.php, I'm trying to creating a session or cookie for domainb.com <?php setcookie("key", "value", time()+3600); session_start(); $_session["key1"] = "value1"; ?> But this code is not working. Please help in solving this issue. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/295405-creating-sessioncookie-using-file_get_contents/ Share on other sites More sharing options...
gizmola Posted April 29, 2015 Share Posted April 29, 2015 Your server? is trying to set a cookie -- where? Cookies are a function of the browser. Also, why are you mixing manual cookie setting and sessions? Quote Link to comment https://forums.phpfreaks.com/topic/295405-creating-sessioncookie-using-file_get_contents/#findComment-1510309 Share on other sites More sharing options...
maxxd Posted April 30, 2015 Share Posted April 30, 2015 Explain 'not working'. The cookie isn't being set at all, the value isn't being read from elsewhere, the value is not what you expected to see, what? And are you trying to set a cookie, or a session variable? It seems like you don't know, and there are differences between the two that can dictate which is the proper choice. Quote Link to comment https://forums.phpfreaks.com/topic/295405-creating-sessioncookie-using-file_get_contents/#findComment-1510406 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.