Я использую это для loggin для magento с curl
session_start();
$string = "login[username]=".urlencode("[email protected]")."&login[password]=".urlencode("password");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.mymagentodomain.co.uk/customer/account/loginPost');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIE, session_name().'='.session_id());
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
curl_setopt($ch, CURLOPT_HEADER, true);
$output = (string) curl_exec($ch);
curl_close($ch);
preg_match('/frontend=(.+); expires=/i', $output, $matches);
$temp = $matches[0];
$sid = str_replace(array("frontend=","; expires="), "", $temp);
1) Я хочу знать, как вести сеанс с завихрением
2) Как получить данные с другой страницы с занесенным в журнал сеансом.
3) Заранее спасибо!
Попробуй это:
session_start();
$cookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'];
session_write_close();
$ch = curl_init('url_here');
...
...
...
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
...
...
curl_exec($ch);
curl_close($ch);