April 20, 200421 yr 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
April 21, 200421 yr 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
April 21, 200421 yr Author 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
April 21, 200421 yr 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
April 21, 200421 yr Author So this will work from my main website www.domain.com even though the cookie has been set at test.domain.com? Excellent! Thanks
April 22, 200421 yr 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
April 22, 200421 yr Author 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
April 23, 200421 yr 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
April 23, 200421 yr Author 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?
April 26, 200421 yr 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
April 26, 200421 yr Author 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
Create an account or sign in to comment