jjshell — 2012-01-06T04:59:30-05:00 — #1
I'm going to have to use data on more than one domain. That data need to be stored, so sessions are out. I guess cookies are out too, since it's a security issue to share one cookie across multiple domains.
How would you approach an application that has to deal with this problem?
wheeler — 2012-01-06T05:48:54-05:00 — #2
What type of data are you talking about?
You could easily share a database table between multiple domains for something like user accounts and then have individual domain specific tables as required.
In SQL you can prefix a table select with a database, ie.
JOIN site_b.users ON site_a.products.user_id = site_b.users.id
wheeler — 2012-01-06T05:49:54-05:00 — #3
btw i'm assuming you mean multiple domains on the same server, which would give you the best results, however you could also have a shared database server that each domain server connects to.
jjshell — 2012-01-06T06:33:32-05:00 — #4
Nope... That would be somesite.com and anothersite.com. Basically, anothersite.com would share data with somesite.com. In other words, somesite.com would need to use data provided by anothersite.com to function properly. Nothing crazy about the data in question, just an id string.
A shared cookie would just be perfect, but it's not safe security-wise, and a bit painful to implement, is it?
wheeler — 2012-01-06T06:51:01-05:00 — #5
im no expert on cookies but you might run into browser issues trying to set 3rd party cookies in browsers with high security settings.
Is there no way to query somesite.com with information that you have available on anothersite.com? If anothersite.com has some shared identifier then you could potentially have a script on somesite.com which would return the data that you want. You could use file_get_contents() for this with some query string parameters. A bit like a bare bones API I guess.
I think it might be helpful if you explain how you got yourself into this situation!
cups — 2012-01-06T13:28:33-05:00 — #6
Does the id key you are talking about change depending on the user? Or is it a site-wide key you just need to update periodically?
serverstorm — 2012-01-06T16:49:46-05:00 — #7
You could serialize the shared data within a database that both sites can talk to then have a common token that link this data to a user or function or however you need to link the data.
One other option is to have siteA implement a JSON service and have siteB connect to siteA's JSON service, get the needed data, and parse it. A JSON service could also be implemented on SiteB so siteA could get data from there. This will effectively pass the data between sites.
cups — 2012-01-06T17:16:50-05:00 — #8
@ServerStorm - wouldn't that have to be a JSONP request because of the Cross Origin Resource problem?
serverstorm — 2012-01-06T17:26:53-05:00 — #9
Whoops Cups yes I meant to put JSONP thanks for clearing that up! Yes a regular JSON request would fail due to the cross origin problem but JSONP will overcome this.
jjshell — 2012-01-13T02:50:34-05:00 — #10
Thanks:) Great ideas, will look into that.
lorenw — 2012-01-13T09:28:17-05:00 — #11
Not sure exactly what you are doing but I have two domains that need to maintain shared data and cURL works perfectly.