Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Logowanie w Curl na rapidshare
radmistrz2
post
Post #1





Grupa: Zarejestrowani
Postów: 143
Pomógł: 4
Dołączył: 2.03.2008

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


Witam. Chce zrobić skrypt, który automatycznie zaloguje mnie na rapidshare i sprawdzi kilka rzeczy. Mam 1 problem. Nie wiem czy da sie zalogowremiumzone.html wygląda następująco:
  1. <form action="https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi" method="post"><table>
  2. <tr><td>Login:</td><td><input type="text" name="login"></td></tr><tr><td>Password:</td><td><input type="password" name="password"></td></tr>
  3. <tr><td colspan="2" align="center"><input type="submit" value="SSL-encrypted Login"></td></tr></table></form>

Wykombinowałem coś takiego ale nie działa:

  1. <?
  2. $cookie = dirname(__FILE__) .'/cookie';
  3. $login = "login";
  4. $haslo = "haslo";
  5. $ch = curl_init("https://ssl.rapidshare.com/premiumzone.html");
  6. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
  7. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
  8. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  9. curl_setopt($ch, CURLOPT_POST, 1);
  10. curl_setopt($ch, CURLOPT_POSTFIELDS, "login=".$login."&password=".$haslo);
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  12. echo curl_exec($ch);
  13. curl_close($ch);
  14. ?>


Ten post edytował radmistrz2 1.05.2008, 20:33:25
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
radmistrz2
post
Post #2





Grupa: Zarejestrowani
Postów: 143
Pomógł: 4
Dołączył: 2.03.2008

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


Teraz mam taki kod:
  1. <?php error_reporting(E_ALL);
  2.  
  3. $curl = curl_init('https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi');
  4. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  5. curl_setopt($curl, CURLOPT_HEADER, 0);
  6. curl_setopt($curl, CURLOPT_POST, true);
  7. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  8. curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  9. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  10. curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
  11. curl_setopt($curl, CURLOPT_COOKIEJAR, "cookiefile"); # SAME cookiefile
  12. curl_setopt($curl, CURLOPT_URL, "https://ssl.rapidshare.com/premiumzone.html"); # this is where you first time connect - GET method authorization in my case, if you have POST - need to edit code a bit
  13. $xxx = curl_exec($curl);
  14. curl_setopt($curl, CURLOPT_POSTFIELDS, "login=4233317&password=rapidshare1"); # form params that'll be used to get form results
  15. curl_close ($curl);
  16. echo $xxx;
  17. ?>

Niestety strona wywala mi błąd: "POST method called without content" a kod błąd w 9 linijce

Czy ktoś mógłby to przetestować na swoim serwerze?
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: 24.12.2025 - 09:52