Witajcie, mam zrobiony skrypt logowania prze CURL, i takie pytanie bo nie mam pomysłu jak zrobić, aby pobrać dane z kodu strony po zalogowaniu (IMG:
style_emoticons/default/questionmark.gif)
Kod logowania:
$f['ips_username'] = 'Login';
$f['ips_password'] = 'haslo';
$f['rememberMe'] = '1';
$f['anonymous'] = '1';
$f['referer'] = 'http://stronka/index.php?';
$f['auth_key'] = '880ea6a14ea49e853634fbdc5015a024';
$f['input_submit'] = 'Zaloguj';
$ch = curl_init();
curl_setopt($ch, CURL_TIMEOUT, 120);
curl_setopt($ch, CURL_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_URL, "http://stronka/index.php?app=core&module=global§ion=login&do=process");
curl_setopt($ch, CURL_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $f);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt
($ch, CURLOPT_COOKIEFILE
, dirname(__FILE__) . '/cookies.txt');curl_setopt
($ch, CURLOPT_COOKIEJAR
, dirname(__FILE__) . '/cookies.txt');curl_exec($ch);
curl_close($ch);
Chciałbym, żeby skrypt pobrał i wyświetlił:
<input type='hidden' name='kodzidopobrania' value='qwerty' />
<input type='hidden' name='kodzidopobrania2' value='qwerty123' />
Prosiłbym o pomoc z góry dzięki.
Dałem radę w połowie z tym mianowicie
$host = "http://stronka/index.php?";
$curl = curl_init($host);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$wynik = curl_exec($curl);
preg_match('#<a href="http://www.tserwery.pl/" title="Tserwery.pl - hosting gier">(.*)</a> #', $wynik, $podaj);
curl_close($curl);
Pokazuje to co chce czyli: Tserwery.pl
Lecz gdy próbuję zrobić tak:
$host = "http://stronka/index.php?";
$curl = curl_init($host);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$wynik = curl_exec($curl);
preg_match("#<input type='hidden' name='kodzidopobrania2' value='(.*)' /> #", $wynik, $podaj);
curl_close($curl);
To już nie wyświetla nic.
Ten post edytował Mati010 6.01.2013, 16:34:20