M
M
McMike2017-05-16 13:27:20
Yii
McMike, 2017-05-16 13:27:20

How to get information from another domain?

In general, there are two sites on different domains, but they look into the same database. It is necessary to carry out cross-authorization, i.e. if a person is logged in on site1 under user1, then when going to site2, he should automatically be logged in under user1 there as well.
How to do it, what are the options?
Can it be done simply?
Why, when requesting from site2 to site1 via file_get_contents(" http://site1 "), I don't get information that the user is logged in to site1 under user1?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kir ---, 2017-05-16
@SowingSadness

Because the browser on site2 does not send cookies from site1.
Otherwise it would be a security disaster.
Cross-domain authorization is done through a third-party authorization service. Or through authorization on the top-level domain.
For example, site2.domain.rf and site1.domain.rf are authorized through domain.rf, which redirects to the desired site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question