springo Posted April 28, 2007 Share Posted April 28, 2007 Hi, I look forward to parsing a dynamic page which requires cookie info to display properly. Is it possible to send cookie info so that file_get_contents() reads the proper page? Thank you for your help. Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/ Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 setting a cookie should work fine with file_get_contents(), unless its on another domain Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240370 Share on other sites More sharing options...
springo Posted April 28, 2007 Author Share Posted April 28, 2007 setting a cookie How can I do that? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240382 Share on other sites More sharing options...
heckenschutze Posted April 28, 2007 Share Posted April 28, 2007 SetCookie("LOOK AT THE DAMN MANUAL") maybe? Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240383 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 setcookie("R.T.F.M", $value, time()+3600); /* expire in 1 hour */ Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240385 Share on other sites More sharing options...
springo Posted April 28, 2007 Author Share Posted April 28, 2007 But that sets a cookie on the user's PC and file_get_contents() requests a file that needs to read the cookie on the server (yes, it's on another domain). Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240389 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 But that sets a cookie on the user's PC and file_get_contents() requests a file that needs to read the cookie on the server (yes, it's on another domain). OK but your question was Hi, I look forward to parsing a dynamic page which requires cookie info to display properly. Is it possible to send cookie info so that file_get_contents() reads the proper page? Thank you for your help. so Step #1 set the cookie, Step #2 use file_get_contents() "to parsing a dynamic page which requires cookie info to display properly" as its on another domain, that domain will have to create the cookie, Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240397 Share on other sites More sharing options...
springo Posted April 28, 2007 Author Share Posted April 28, 2007 The actual problem is that the domain creates a cookie that stores a default lenguage based on my (host) IP and I'd like to use another cookie because the one I get is wrong. Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240402 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 whats wrong with the cookie creation ? nm.. i give! Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240404 Share on other sites More sharing options...
springo Posted April 28, 2007 Author Share Posted April 28, 2007 OK let me explain it more clearly: 1- Hosting located in Spain runs my script which calls file_get_contents() to parse a website 2- Parsed website finds no cookie specifying a language on my host, so it creates one according to IP (so cookie will say "Spanish") 3- Returned contents are in Spanish so my parsing script won't work So basically what I need is a customized cookie saying "English", so that when I try to file_get_contents(), the parsed website returns contents in English. Thank you and sorry if I don't make myself clear enough. Quote Link to comment https://forums.phpfreaks.com/topic/49060-file_get_contents-using-cookie-information/#findComment-240439 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.