Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]2 pytania (rozbijanie i 2 inputy o takiej samej nazwie)
k4r3r
post
Post #1





Grupa: Zarejestrowani
Postów: 43
Pomógł: 1
Dołączył: 6.07.2011

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


1.Mam coś takiego w pliku coś.txt:
  1. cos='385278372'konieccosia


poszukuje funkcji w której podam tylko:
  1. cos='

i
  1. 'konieccosia

a ona zwróci mi to co jest pomiędzy tym co podałem(385278372)

2.Mam 2 inputy o takiej samej nazwie, jedna ma jednak inny class. Jak ustawić w curlu aby skrypt zmieniał value tego 2 inputa co ma inny class?

Ten post edytował k4r3r 18.08.2011, 17:07:35
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
k4r3r
post
Post #2





Grupa: Zarejestrowani
Postów: 43
Pomógł: 1
Dołączył: 6.07.2011

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


dobra, mam funkcje ale kolejny problem:

  1. function _hslk($site){
  2. if (preg_match("/hslk\' value=\'[a-z 0-9]+/i", $site, $val)){
  3. $hslk = str_replace('hslk\' value=\'', '', $val['0']);
  4. }
  5. if (isset($hslk)){
  6. return $hslk;
  7. } else {
  8. return false;
  9. }
  10. }
  11.  
  12. function animus_login($login, $haslo) {
  13. $cookie_file = 'cookie.txt';
  14. $c = curl_init();
  15. curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_file);
  16. curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_file);
  17. curl_setopt($c, CURLOPT_URL, 'http://prisonwars.pl/');
  18. curl_setopt($c, CURLOPT_POST, 1);
  19. curl_setopt($c, CURLOPT_POSTFIELDS, 'hslk='._hslk(animus_login($login, $haslo)).'&login='.$login.'&password='.$haslo);
  20. curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  21. $s = curl_exec($c);
  22. curl_close($c);
  23. echo $s;
  24. }
  25. ?>


przy tym kodzie wywala mi white screena(hslk jest ukryte).


  1. function _hslk($site){
  2. if (preg_match("/hslk\' value=\'[a-z 0-9]+/i", $site, $val)){
  3. $hslk = str_replace('hslk\' value=\'', '', $val['0']);
  4. }
  5. if (isset($hslk)){
  6. return $hslk;
  7. } else {
  8. return false;
  9. }
  10. }
  11.  
  12. function animus_login($login, $haslo) {
  13. $cookie_file = 'cookie.txt';
  14. $c = curl_init();
  15. curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_file);
  16. curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_file);
  17. curl_setopt($c, CURLOPT_URL, 'http://prisonwars.pl/');
  18. curl_setopt($c, CURLOPT_POST, 1);
  19. curl_setopt($c, CURLOPT_POSTFIELDS, 'login='.$login.'&password='.$haslo);
  20. curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  21. $s = curl_exec($c);
  22. curl_close($c);
  23. echo $s;
  24. }
  25. ?>


jednak przy tym kodzie(usunięte hslk) wszystko jest ok...
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: 14.10.2025 - 08:20