Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Logowanie cURL
red9skull
post
Post #1





Grupa: Zarejestrowani
Postów: 157
Pomógł: 0
Dołączył: 11.07.2009
Skąd: root

Ostrzeżenie: (10%)
X----


Kod skrytpu:
  1. <?
  2. $hand = curl_init();
  3. $url = 'http://board.info.pl/ucp.php?mode=login';
  4. curl_setopt($hand, CURLOPT_URL, $url);
  5. curl_setopt($hand, CURLOPT_HEADER, 1);
  6. curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0");
  8. curl_setopt($hand, CURLOPT_REFERER, 'http://board.info.pl/ucp.php?mode=login');
  9. curl_setopt($hand, CURLOPT_COOKIESESSION, 1);
  10. $site = curl_exec($hand);
  11. curl_close($hand);
  12.  
  13. //$username = 'login';
  14. //$password = 'hasło';
  15. $post = 'ucp.php?mode=login username=login&password=hasło&redirect=index.php&login=Zaloguj' ;
  16.  
  17. $hand = curl_init();
  18. curl_setopt($hand, CURLOPT_HTTPHEADER, array(
  19. 'Host: board.info.pl',
  20. 'User-Agent: Mozilla/5.0',
  21. 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  22. 'Accept-Language: pl,en-us;q=0.7,en;q=0.3',
  23. 'Accept-Encoding: gzip,deflate',
  24. 'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7',
  25. 'Keep-Alive: 300',
  26. 'Connection: keep-alive',
  27. 'Referer: <a href="http://board.info.pl/ucp.php?mode=login'" target="_blank">http://board.info.pl/ucp.php?mode=login'</a>
  28. )
  29. );
  30. curl_setopt($hand, CURLOPT_URL, 'http://board.info.pl/ucp.php?mode=login');
  31. curl_setopt($hand, CURLOPT_POST, 1);
  32. curl_setopt($hand, CURLOPT_POSTFIELDS, $post);
  33. curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
  34. $site = curl_exec($hand);
  35. curl_close($hand);
  36. print $site;
  37. ?>


I zwraca: http://mazishare.co.cc/zobaczymy.php

Wiecie co robię źle?


--------------------
zmoderowano - zbyt fajna
Go to the top of the page
+Quote Post
vokiel
post
Post #2





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

Ostrzeżenie: (0%)
-----


usuń:
11. curl_close($hand);
...
17. $hand = curl_init();

I zobacz co zwróci


--------------------
Go to the top of the page
+Quote Post
red9skull
post
Post #3





Grupa: Zarejestrowani
Postów: 157
Pomógł: 0
Dołączył: 11.07.2009
Skąd: root

Ostrzeżenie: (10%)
X----


Hmm.. zobacz sam: http://mazishare.co.cc/zobaczymy.php

Any idea?


--------------------
zmoderowano - zbyt fajna
Go to the top of the page
+Quote Post
vokiel
post
Post #4





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

Ostrzeżenie: (0%)
-----


Tak sobie patrzę, że masz źle skonstruowany post:

  1. $post = 'ucp.php?mode=login username=login&password=hasło&redirect=index.php&login=Zaloguj' ;

Podajesz w nim adres pliku, zamiast samych danych klucz&wartość

No i skoro chcesz się logować na stronę to zapisuj ciasteczka


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 19:06