on one site there are working features auto-login:
when you click on the link
https://example.url/api/login/{key}/{username} the user is redirected to your personal account -
https://example.url
if the data entered is correct, then is redirected to the login page -
https://example.url/login
actually the problem: run the test from another domain - there was a good user for auto-login.
as I understand it, the mechanics should be as follows: performed cross-browser request for a page
https://example.url/api/login/{key}/{username}, which takes into account all redirects. and in the end, it reads the url of the target page (control panel or login page)
after reading similar questions I came to the conclusion that to make such a request through curl, but itself, because of the lack of experience with it, and not mastered
$url = https://example.url/api/login/{key}/{username};
if function-to-check-autologin($url) == "true" {
//do something
} - Maurice.Spencer commented on September 19th 19 at 00:18
if function-to-check-autologin($url) == "true" {
header('location:'.$url) ;
}else
header('location: https://example.url/login') ; - jarret.Wa commented on September 19th 19 at 00:21
To GET enough of the same code, only $data = file_get_content($url). In $data will be the contents of the response that the server displays on the page. - jarret.Wa commented on September 19th 19 at 00:27
the following code:
// initialization
$h = curl_init();
//setup parameters for the query
curl_setopt($h, CURLOPT_URL,"httpс://myexample.EN/");
curl_setopt($h, CURLOPT_HEADER, 0);
//drag contents
$cont = curl_exec($h);
echo $cont;
//close the object
curl_close($h);
And enable output of all errors on the page. Can you curl is not installed and you do not know? - jarret.Wa commented on September 19th 19 at 00:33