Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> Curl logowanie
seomaster
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 26.08.2010

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


Witam,

Mam skrypt logowania do serwisów. Działa przykładowo na forach ale na innych stronach zwraca mi białą stronę :/ I nie są to strony które uzywają jakiś tokenów. Po prostu proste strony z logowaniem bądź formularzem. Nic się nie dzieje tylko mi zwraca pustą stronę.

Aha dodawałem do kodu linijki aby były wyświetlane błędy ale to nic nie dało. Nadal tylko pusta strona.

  1. <?php
  2.  
  3. ini_set('display_error','1');
  4. curl_login('http://mwarrior.org/index.php?step=wrota','email=MOJMAIL&pass=MOJEHASLO','','off');
  5. curl_grab_page('http://mwarrior.org/hospital.php?action=heal','','');
  6.  
  7.  
  8. function curl_login($url,$data,$proxy,$proxystatus){
  9. $fp = fopen("cookie.txt", "w");
  10. fclose($fp);
  11. $login = curl_init();
  12. curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
  13. curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
  14. curl_setopt($login, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  15. curl_setopt($login, CURLOPT_TIMEOUT, 40);
  16. curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE);
  17. if ($proxystatus == 'on') {
  18. curl_setopt($login, CURLOPT_SSL_VERIFYHOST, FALSE);
  19. curl_setopt($login, CURLOPT_HTTPPROXYTUNNEL, TRUE);
  20. curl_setopt($login, CURLOPT_PROXY, $proxy);
  21. }
  22. curl_setopt($login, CURLOPT_URL, $url);
  23. curl_setopt($login, CURLOPT_HEADER, TRUE);
  24. curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  25. curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE);
  26. curl_setopt($login, CURLOPT_POST, TRUE);
  27. curl_setopt($login, CURLOPT_POSTFIELDS, $data);
  28. ob_start(); // prevent any output
  29. return curl_exec ($login); // execute the curl command
  30. ob_end_clean(); // stop preventing output
  31.  
  32. curl_close ($login);
  33. unset($login);
  34. }
  35.  
  36. function curl_grab_page($site,$proxy,$proxystatus){
  37. $ch = curl_init();
  38. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  39. if ($proxystatus == 'on') {
  40. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  41. curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
  42. curl_setopt($ch, CURLOPT_PROXY, $proxy);
  43. }
  44. curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  45. curl_setopt($ch, CURLOPT_URL, $site);
  46. ob_start(); // prevent any output
  47. return curl_exec ($ch); // execute the curl command
  48. ob_end_clean(); // stop preventing output
  49. curl_close ($ch);
  50. }
  51.  
  52.  
  53.  
  54.  
  55. ?>


Aha oczywiście plik cookie istnieje i się dobrze sprawuje. Posiada prawa do zapisu.
Go to the top of the page
+Quote Post
CuteOne
post
Post #2





Grupa: Zarejestrowani
Postów: 2 958
Pomógł: 574
Dołączył: 23.09.2008
Skąd: wiesz, że tu jestem?

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


Sprawdź:

  1. <?php
  2.  
  3. function cURL_POST($url,$data)
  4. {
  5. $ch = curl_init();
  6. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
  7. curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
  8. curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  9. curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
  10. curl_setopt($ch, CURLOPT_URL,$url);
  11. curl_setopt($ch, CURLOPT_HEADER, false);
  12. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
  14. curl_setopt($ch, CURLOPT_POST, 1);
  15. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  16. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  17.  
  18.  
  19. return curl_exec($ch);
  20. }
  21.  
  22. function cURL($url)
  23. {
  24. $ch = curl_init();
  25. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
  26. curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
  27. curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  28. curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
  29. curl_setopt($ch, CURLOPT_URL,$url);
  30. curl_setopt($ch, CURLOPT_HEADER, false);
  31. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  32. curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
  33. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
  34.  
  35.  
  36. return curl_exec($ch);
  37. }
  38. }


  1. $url_login = 'moj_adres_logowania';
  2. $login = 'moj_login';
  3. $pass = 'moj_pass';
  4.  
  5. $url_po_zalogowaniu = 'moj_adres_po_zalogowniu';
  6.  
  7. cURL_POST($url_login,'login='.$login.'&password='.$pass);
  8. echo cURL($url_po_zalogowaniu);


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





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




@Lethys (@seomaster) za multi konto dostajesz kolejne ostrzeżenie
Go to the top of the page
+Quote Post

Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 18.09.2025 - 09:04