O, dzięki za niedopatrzenie.

Wszystko działa PRAWIE elegancko, gdyby nie fakt, że identyfikator sesji jest nieaktualny. Co muszę zrobić, aby wczytać ten aktualny identyfikator?
<?php
$cookies = dirname(__FILE__) .'/cookievf67dvtsd76ft67rvdvf5be5b23bqnk.txt'; $link = "http://gsmx.co";
$post = 'login=testowe12&register=0&password=testowe12&cookie_check=1&_xfToken=&redirect='.urlencode($link);
$curl_handle2 = curl_init('http://gsmx.co/logowanie/login');
curl_setopt($curl_handle2, CURLOPT_COOKIESESSION, true);
curl_setopt($curl_handle2, CURLOPT_COOKIEJAR, $cookies);
curl_setopt($curl_handle2, CURLOPT_COOKIEFILE, $cookies);
curl_setopt($curl_handle2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle2, CURLOPT_HEADER, 1);
$fp = fopen("cookievf67dvtsd76ft67rvdvf5be5b23bqnk.txt", "r"); $tekst = fread($fp,10000
); $rest = substr($tekst, -34
); // sessionid
curl_setopt
($curl_handle2, CURLOPT_HTTPHEADER
, array( 'Host: gsmx.co',
'Content-Length: 93',
'Cache-Control: max-age=0',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Origin: <a href="http://gsmx.co'" target="_blank">http://gsmx.co'</a>,
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded',
'Referer: <a href="http://gsmx.co/login'" target="_blank">http://gsmx.co/login'</a>,
'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4',
'Cookie: xf_session='.$rest2.'; GCSCU_770734409090_H2=C=770734409090.apps.googleusercontent.com:S=81bef9fa0c3fbd
aac13c33f8b709fc73474d3562.kvhqgGncJscCDSvW.7dde:I=1403792615:X=1403879015' ));
curl_setopt($curl_handle2, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handle2, CURLOPT_POSTFIELDS, $post);
$output2 = curl_exec($curl_handle2);
?>

Kolejna próba rozwiązania tego samego problemu:
<?php
$cookies = dirname(__FILE__) .'/cookievf67dvtsd76ft67rvdvf5be5b23bqnk.txt'; $link = "http://gsmx.co";
$post = 'login=testowe12&register=0&password=testowe12&cookie_check=1&_xfToken=&redirect='.urlencode($link);
$curl_handle = curl_init('http://gsmx.co/login');
curl_setopt($curl_handle, CURLOPT_COOKIESESSION, true);
curl_setopt($curl_handle, CURLOPT_COOKIEJAR, $cookies);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle, CURLOPT_HEADER, 1);
curl_setopt
($curl_handle, CURLOPT_HTTPHEADER
, array( 'Host: gsmx.co',
'Content-Length: 93',
'Cache-Control: max-age=0',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Origin: <a href="http://gsmx.co'" target="_blank">http://gsmx.co'</a>,
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded',
'Referer: <a href="http://gsmx.co/login'" target="_blank">http://gsmx.co/login'</a>,
'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4'));
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $post);
$output = curl_exec($curl_handle);
$fp = fopen("cookievf67dvtsd76ft67rvdvf5be5b23bqnk.txt", "r"); $tekst = fread($fp,10000
); $rest = substr($tekst, -34
); // sessionid
$curl_handle2 = curl_init('http://gsmx.co/logowanie/login');
curl_setopt($curl_handle2, CURLOPT_COOKIEFILE, $cookies);
curl_setopt($curl_handle2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle2, CURLOPT_HEADER, 1);
curl_setopt
($curl_handle2, CURLOPT_HTTPHEADER
, array( 'Host: gsmx.co',
'Content-Length: 93',
'Cache-Control: max-age=0',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Origin: <a href="http://gsmx.co'" target="_blank">http://gsmx.co'</a>,
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded',
'Referer: <a href="http://gsmx.co/login'" target="_blank">http://gsmx.co/login'</a>,
'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4',
'Cookie: xf_session='.$rest2.'; GCSCU_770734409090_H2=C=770734409090.apps.googleusercontent.com:S=81bef9fa0c3fbd
aac13c33f8b709fc73474d3562.kvhqgGncJscCDSvW.7dde:I=1403792615:X=1403879015'));
curl_setopt($curl_handle2, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handle2, CURLOPT_POSTFIELDS, $post);
$output2 = curl_exec($curl_handle2);
?>
Odwiedzam stronę, tworzę nowy plik cookie i zapisuje w nim identyfikator sesji:
curl_setopt($curl_handle, CURLOPT_COOKIESESSION, true);
curl_setopt($curl_handle, CURLOPT_COOKIEJAR, $cookies);
Zapisuję identyfikator do zmiennej:
$fp = fopen("cookievf67dvtsd76ft67rvdvf5be5b23bqnk.txt", "r"); $tekst = fread($fp,10000
); $rest = substr($tekst, -34
); // sessionid
Wysyłam dane POST'em, dorzucając identyfikator sesji:
curl_setopt($curl_handle2, CURLOPT_COOKIEFILE, $cookies);
Co jest nie tak?
@refresh
_____________________
Wpadłem na jeszcze jedno rozwiązanie:
<?php
$post = 'login=testowe12&register=0&password=testowe12&cookie_check=1&_xfToken=&redirect='.urlencode("http://gsmx.co");
$handle = curl_init('http://gsmx.co/logowanie/login');
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_HEADER, 1);
curl_setopt
($handle, CURLOPT_HTTPHEADER
, array( 'Host: gsmx.co',
'Content-Length: 93',
'Cache-Control: max-age=0',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Origin: <a href="http://gsmx.co'" target="_blank">http://gsmx.co'</a>,
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded',
'Referer: <a href="http://gsmx.co/login'" target="_blank">http://gsmx.co/login'</a>,
'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4'));
//'Cookie: xf_session='.$cookie["xf_session"].'; GCSCU_770734409090_H2=C=770734409090.apps.googleusercontent.com:S=81bef9fa0c3fbd
aac13c33f8b709fc73474d3562.kvhqgGncJscCDSvW.7dde:I=1403792615:X=1403879015'));
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($handle, CURLOPT_POSTFIELDS, $post);
$output = curl_exec($handle);
preg_match('/^Set-Cookie:\s*([^;]*)/mi', $output, $cookie);
echo $cookie["xf_session"].'<br>'.$output; ?>
Problem jest następujący: odczytałem identyfikator sesji, ale żeby go użyć, muszę ponownie wczytać stronę, co wiąże się z jego zmianą.
Jak mogę dynamicznie użyć tego aktualnego identyfikatora sesji?
Pozdrawiam.