Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]CURL - problem
Wertas
post
Post #1





Grupa: Zarejestrowani
Postów: 45
Pomógł: 0
Dołączył: 2.03.2010

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


Witam. Proszę wypróbować skrypt
  1. <link type="text/css" rel="stylesheet" href="states.css">
  2. <?php
  3.  
  4. $cookie_file = "cookie.txt";
  5. $headers = array('Accept-Language: pl,en-us;q=0.7,en;q=0.3',
  6. 'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7');
  7.  
  8. $ch = curl_init('http://www.empcraft.pl/auth/login');
  9. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12;MEGAUPLOAD 1.0");
  10. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  11. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  12. curl_setopt($ch, CURLOPT_POST, 1);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, 'login=xxxx&password=xxxx');
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  15. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  16. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  17. $s = curl_exec($ch);
  18.  
  19.  
  20. curl_close($ch);
  21.  
  22. $ch = curl_init("http://s1.empcraft.pl/executeStat.do?operation=statHero");
  23. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  24. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  25.  
  26.  
  27. $output = curl_exec($ch); // Run curl
  28.  
  29. curl_close($ch);
  30.  
  31.  
  32. die($output);
  33.  
  34.  
  35. ?>


Plik css http://hotfile.com/dl/90507824/0868401/states.css.html


Tutaj zdjęcie 1 : http://i7.photobucket.com/albums/y287/Reno...aft/artwork.png
Tutaj zdjęcie 2 : http://i7.photobucket.com/albums/y287/Reno...0cRaft/1a1d.png

Już porostu nie mogę sprawdzałem str, substr i parę innych i nie mogę pobrać tej tabeli. Jestem zupełnie zielony w sprawach substr itp.

Nie mogę rozwiązać tego proszę o pomoc (IMG:style_emoticons/default/sad.gif)

Ten post edytował batman 19.12.2010, 19:47:15
Powód edycji: [batman]: zdajesz sobie sprawę, że podałeś login i hasło do konta?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Wertas
post
Post #2





Grupa: Zarejestrowani
Postów: 45
Pomógł: 0
Dołączył: 2.03.2010

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


Cytat(batman @ 19.12.2010, 19:56:59 ) *
A co na to regulamin serwisu?



php.pl? czy tamten? jak tamten no nie ma sprawy

te hasla to testowe byly (IMG:style_emoticons/default/biggrin.gif) zeby sprawdzic inaczej nie zadziala skrypt


// Chodzi o regulamin tamtego serwisu. Sprawdziłem go i nie wygląda na to, abyś go łamał.
// ~batman


  1. <link type="text/css" rel="stylesheet" href="states.css">
  2. <?php
  3.  
  4. $cookie_file = "cookie.txt";
  5. $headers = array('Accept-Language: pl,en-us;q=0.7,en;q=0.3',
  6. 'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7');
  7.  
  8. $ch = curl_init('http://www.empcraft.pl/auth/login');
  9. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12;MEGAUPLOAD 1.0");
  10. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  11. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  12. curl_setopt($ch, CURLOPT_POST, 1);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, 'login=&password=');
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  15. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  16. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  17. $s = curl_exec($ch);
  18. if (curl_errno($ch)) {
  19. echo 'Błąd #' . curl_errno($ch) . ': ' . curl_error($ch);
  20. }
  21. curl_close($ch);
  22.  
  23. $ch = curl_init("http://s1.empcraft.pl/executeStat.do?operation=statHero");
  24. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  25. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  26. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  27. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  28. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  29. $result = curl_exec($ch); // wykonanie skryptu
  30. curl_close($ch);
  31.  
  32.  
  33. $sections=explode("<div>", $result);
  34. foreach ($sections as $key=>$item){
  35. if($key)
  36. print "$item<br>";
  37. }
  38. print_r($section);
  39. ?>
  40.  
  41.  
  42.  


Juz wyglada lepiej ale jak wybrac dokladnie wnetrza tabeli i dac to w array i forach?

Ten post edytował batman 19.12.2010, 20:10:22
Powód edycji: [batman]:
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 12.10.2025 - 13:22