mattal999 Posted July 21, 2009 Share Posted July 21, 2009 Hi, What I'm trying to do is retrieve the ownerid of a user logged into another site. To do this, I have tried using file_get_contents on the url and explode the correct part out. Now I have run into a problem. Using file_get_contents on the page works fine, but it uses the server's cookies, not the user's, so the page retrieved is a login page (basically). I can think of no other way to basically read what id the user logged in is. This value is used in a url like so: http://www.domain.com/members/$theid, and I have written code to grab this id. Only problem now is requesting the page, basically using the user's local settings/cookies to get the correct, logged in page. If not, then can I get the value of a cookie from another domain, called 'ownerid'? Thanks, mattal999 Quote Link to comment https://forums.phpfreaks.com/topic/166830-solved-file_get_contents-on-another-domain-using-users-cookies/ Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 For a LONG list of security reasons, none of these options are possible. The only thing you can do to access the persons data from another server is to convince them to provide you their name/password for that site, then using the server to connect, login, and retrieve. If you provide specifics on what you are trying to accomplish, i might be able to provide another option Quote Link to comment https://forums.phpfreaks.com/topic/166830-solved-file_get_contents-on-another-domain-using-users-cookies/#findComment-879715 Share on other sites More sharing options...
mattal999 Posted July 21, 2009 Author Share Posted July 21, 2009 For a LONG list of security reasons, none of these options are possible. The only thing you can do to access the persons data from another server is to convince them to provide you their name/password for that site, then using the server to connect, login, and retrieve. That's exactly what I just thought of. Tried it and voila! With a bit of cURL, it works a treat. Thanks anyway. Quote Link to comment https://forums.phpfreaks.com/topic/166830-solved-file_get_contents-on-another-domain-using-users-cookies/#findComment-879732 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.