Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]CURL - problem
Wertas
post 19.12.2010, 17:46:00
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 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
Fifi209
post 19.12.2010, 19:24:31
Post #2





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


I teraz każdy będzie kopiował i testował? Nie potrafisz opisać problemu?

Zapisz sobie wynik do pliku file_put_contents i zobacz jak faktycznie wygląda plik


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
Wertas
post 19.12.2010, 19:40:08
Post #3





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

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


Nie działa ta funkcja
Go to the top of the page
+Quote Post
batman
post 19.12.2010, 19:48:09
Post #4





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Pozwól, że zapytam. Jaki chcesz osiągnąć końcowy efekt?


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Fifi209
post 19.12.2010, 19:52:34
Post #5





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


Cytat(Wertas @ 19.12.2010, 19:40:08 ) *
Nie działa ta funkcja

Co znaczy nie działa? smile.gif


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
Wertas
post 19.12.2010, 19:54:04
Post #6





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

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


Cytat(batman @ 19.12.2010, 19:48:09 ) *
Pozwól, że zapytam. Jaki chcesz osiągnąć końcowy efekt?



Przedstawiony skrypt ma mi utworzyc tabele na nowo tyle ze czysta moze do arraya sprowadzona. Zebym mogl ja przetwarzac.

Go to the top of the page
+Quote Post
batman
post 19.12.2010, 19:56:59
Post #7





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Cytat(Wertas @ 19.12.2010, 19:54:04 ) *
Przedstawiony skrypt ma mi utworzyc tabele na nowo tyle ze czysta moze do arraya sprowadzona. Zebym mogl ja przetwarzac.

A co na to regulamin serwisu?


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Wertas
post 21.12.2010, 17:03:46
Post #8





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 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

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 Wersja Lo-Fi Aktualny czas: 18.07.2025 - 15:27