I'm working with drupal 7 and REST api. I'd like to log in into drupal with curl and later when i visit the website with a browser i want to be logged in.
i'm usin gthis code:
<?php
$user_data = array(
'username' => 'usertest',
'password' => 'pass',
);
$ch = curl_init();
$tmpfname = dirname(__FILE__).'/'.$_COOKIE['PHPSESSID'].'.txt';
curl_setopt($ch, CURLOPT_URL, "http://example.com/networklogin/user/login");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $user_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt( $ch, CURLOPT_COOKIESESSION, true );
curl_setopt( $ch, CURLOPT_COOKIEJAR, $tmpfname );
curl_setopt( $ch, CURLOPT_COOKIEFILE, $tmpfname );
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
?>
And it works pretty well, it logs the user in, but when i visit "example.com" i'm not logget in as "usertest". Is there any way to log me into Drupal and allow me to access with a browser?
The goal is to log me in into many website with the same users when i log in into one as i wrote here (Same webserver, same drupal, same db, single sign on?).