Solved

Any way to "share" PHP session variables between two domains?

Posted on 2011-03-23
3
319 Views
Last Modified: 2012-05-11
We have two websites featuring two aspects of our business: metrology and robotics. As these two are related, we have many links between these two sites, and they are designed to work seamlessly - they even look similar.
We don't have any LOG IN forms on either one of the sites, but, we have "quote request" forms for different items. Many times, a customer will fill out their info in one of the forms and request the quote, I would save their contact info in PHP session variables and when they move onto another quote request during the same visit, their contact info is pre-filled in the form.  It is convenient to the customer, but...

but, of course, once they leave one site and go to our other site, the session variables are lost.

Is there any way to retain the session variables values between two sites?
0
Comment
Question by:Erie_Laker
  • 2
3 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35202085
No, not without explicitly transferring them.  You would have to read them all and pass them via a POST to the other site.

The other choice is to put all that in a database which you can share between sites.  You would have to come up with another way to track the customer but that's doable.
0
 

Author Comment

by:Erie_Laker
ID: 35301581
@Dave
"The other choice is to put all that in a database which you can share between sites.  You would have to come up with another way to track the customer but that's doable."

Could you please explain how?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 35301733
You can set up databases like MySQL and MS SQL so they can be accessed from anywhere with a username and password.  I edit the databases on my websites from a page running on the webservers here at home.  The database server(s) is independent from the web servers.

So if you save the original info from either site in the database, you can access it again when your customer goes to the other site.  You would still have to come up with a way to recognize them because cookies and session data don't transfer between sites.  Some kind of login in the original quote form would do.  Note that once it's in the database, it doesn't disappear with the customer and you can access it later if you want to.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question