![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 62 Pomógł: 2 Dołączył: 24.02.2008 Ostrzeżenie: (0%) ![]() ![]() |
Witam chce sie zalogowac na moje konto na erepublik.com w celu pobrania czesci informacji... Pewnie ktos powie ze jest od tego api ale ja chce pobrac wartosc pensji moich pracownikow a tego tam niema. Dobra to wyglada to tak uzywam ponizszego kodu i po jego uzyciu otrzymuje komunikat "CSRF attack detected.", chce sie tylko zalogowac token pobieram wiec dlaczego dostaje taki komunikat?
Kod <?php
function token($content) { preg_match("@<input type=\"hidden\" id=\"_token\" name=\"_token\" value=\"(.*?)\" \/>@i", $content, $w); return $w[1]; } $hand = curl_init(); //pobieranie tokena curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/en/login'); curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1); curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1)"); $p=curl_exec($hand); $token = token($p); //logowanie curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/en/login'); curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1); curl_setopt($hand, CURLOPT_POST, 1); curl_setopt($hand, CURLOPT_POSTFIELDS, "_token={$token}&citizen_name=login&citizen_password=haslo&commit=Login"); curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1)"); $p=curl_exec($hand); echo htmlspecialchars($p); curl_close($hand); ?> |
|
|
![]() ![]() |
![]() |
Aktualny czas: 19.08.2025 - 20:32 |