Batfastad Posted April 20, 2004 Posted April 20, 2004 More of a PHP question maybe but... I think this might be down to what I set the cookie path and domain as but... We host some databases on the web and the domain is dealer-world.com We have our main webspace with our host, but also some PHP enabled webspace on a different server at dealerworld.plus.com I have a couple of cookies set using the FMP-SetCookie CDML command, but I don't use the path or domain options for the cookie. Is it possible for me to access those cookies from my PHP website, even though the domain is different? I want to have as few pages running from filemaker as possible, to reduce loads and keep only the actual CDML format pages on our filemaker web server. What's the PHP syntax I would use to read the value of those cookies?? FileMaker Version: Server 5 Platform: Windows 2000
Garry Claridge Posted April 21, 2004 Posted April 21, 2004 As far as I know you will not be able to access them because they are from a different domain. Can you pass the data to the php scripts as GET or POST values? Good Luck. Garry
Batfastad Posted April 21, 2004 Author Posted April 21, 2004 Not sure about that. Would I be able to access them if I moved our PHP platform over to our main domain www.domain.com? So our cdml pages are served from web.domain.com and our php pages are from www.domain.com? Would that work? As the domain is domain.com in both cases? FileMaker Version: Server 5 Platform: Windows 2000
Jeff Spall Posted April 21, 2004 Posted April 21, 2004 Hi, I'm setting cookies in PHP and FMPro and each read and write OK. Because most web browsers are set to only allow cookies that are read back by the original server, you must set and read them from the same domain. It works OK if you're using different ports for webserver and FMPro. "What's the PHP syntax I would use to read the value of those cookies" - just the regular php ones, like if($_COOKIE['mycookie'] == "a value") or $myVariable = $_COOKIE['mycookie']; - I don't think either PHP or FMPro can tell how the cookie's been set regards, jeff
Batfastad Posted April 21, 2004 Author Posted April 21, 2004 So this will work from my main website www.domain.com even though the cookie has been set at test.domain.com? Excellent! Thanks
Jeff Spall Posted April 22, 2004 Posted April 22, 2004 Hi, no, any cookie can only be read by the domain that set it. So you can have FMPro and Apache both setting and reading cookies on the same server, but not different ones. Even subdomains (like webserver.mydomain.com and data.mydomain.com) don't work, but "mydomain.com" and "mydomain:591.com" does work and is the way I've used it between php and FMPro. regards, jeff
Batfastad Posted April 22, 2004 Author Posted April 22, 2004 So so long as I specify in the domain attribute of [FMP-SetCookie domain.com it should be able to be read by pages at www.domain.com and at remote.domain.com? FileMaker Version: Server 5 Platform: Windows 2000
Jeff Spall Posted April 23, 2004 Posted April 23, 2004 Hi, I tried that and if the domain is not a correct one for that server it errors and does not set. I think this is a browser security thing and you have to set and read from the same server. Normally, you don't need to specify domain a all as the browser picks it up. regards, jeff
Batfastad Posted April 23, 2004 Author Posted April 23, 2004 But what about for subdomains, of the same domain? As technically the domain is the same! they are hosted on different servers though. old.domain.com hosted at our offices, and www.domain.com hosted at our ISP. Does the browser just pick up domain.com in both cases, or will it pick up www.domain.com and old.domain.com?
Jeff Spall Posted April 26, 2004 Posted April 26, 2004 Hi, again it needs to be on the same server. Subdomains on different servers don't work (I've tried it). I think what is being looked at is the IP address. Jeff
Batfastad Posted April 26, 2004 Author Posted April 26, 2004 Pants! That's pretty annoying. Obviously a limitation or I suppose a security feature of cookies.. Oh well - time to find a work around! Thanks anyway
Recommended Posts
This topic is 7857 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now