Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z wyslaniem na zmienna
-Gość_edi-
post
Post #1





Goście







Witam mam takie zadanie:
Jestem zalogowany na stronie "x", aby wejsc na strone "x/dalej.php" musze wyslac na zmienna $login swoj login (test) ktory wykorzystalem przy pierwszym logowaniu (zakodowany w MD5), a na zmienna $pass swoje haslo (haslo).
Probowalem zrobic to w ten sposob:
test - MD5 - 098F6BCD4621D373CADE4E832627B4F6
haslo - MD5 - 207023CCB44FEB4D7DADCA005CE29A64

http://x/dalej.php?login=098F6BCD4621D373C...DADCA005CE29A64

niestety nic to nie daje
Prosze o pomoc, jakies wskazowki.
thx
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
mike
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Formularz na tamtej stronie należy przesłać metoda POST a nie GET.
Użyj do tego cURL
Go to the top of the page
+Quote Post
-Gość_edi-
post
Post #3





Goście







napisalem cos takiego:
  1. <?php
  2. $c = curl_init();
  3. curl_setopt($c, CURLOPT_URL, "http://x/dalej.php");
  4. curl_setopt($c, CURL_POST, 1);
  5. curl_setopt($c, CURLOPT_POSTFIELDS, "login=098F6BCD4621D373CADE4E832627B4F6&haslo=207023CCB44FEB4D7DADCA005CE29A64");
  6. curl_exec($c);
  7. curl_close($c); 
  8. ?>


niestety nie pomoglo
Go to the top of the page
+Quote Post
mike
post
Post #4





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Hmmm, a daj tak:

  1. <?php
  2.  
  3. // ...
  4.  
  5. $strResult = curl_exec($c);
  6. echo $strResult;
  7.  
  8. ?>
Go to the top of the page
+Quote Post
-Gość_edi-
post
Post #5





Goście







Kod
Warning: curl_exec(): 2 is not a valid cURL handle resource in c:\usr\apache\httpd\html\a.php on line 9

9 linia to
Kod
$strResult = curl_exec($c);


z kolei jak robie cos takiego:
  1. <?php
  2.  
  3. (...)
  4. curl_exec($c);
  5. $strResult = curl_exec($c);
  6. echo $strResult;
  7. curl_close($c);
  8.  
  9. ?>


to wywala to samo (dwie takie same strony jedna pod druga) co przy pierwszej metodzie z "get"
Go to the top of the page
+Quote Post
-Gość_edi-
post
Post #6





Goście







Juz sobie poradzilem.
Nie potrzebowalem curl-a (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Pozdrawiam
Go to the top of the page
+Quote Post

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: 23.08.2025 - 17:36