Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Automatyczne logowanie
Watt
post
Post #1





Grupa: Zarejestrowani
Postów: 372
Pomógł: 1
Dołączył: 13.06.2008

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


Witam!

Chciałem zarobić trochę $ na uploadzie plików na wiele serwisów, pomyślałem sobie, że automat zrobi to za mnie lepiej no i oczywiście utknąłem na zanym początku sad.gif problemem jest serwis rapidgator, napisałem curla, aby się tam logował no i skubaniec nie odbira sesji - nie wiem dlaczego!

Czesc ich kodu html z logowaniem:
Kod
                   <form id="login" action="/auth/login" method="post">
                        <div class="popup-login hidden">
                            <input type="text" class="txt up-login" name="LoginForm[email]"/>
                            <input type="password" class="txt up-login" name="LoginForm[password]"/>
                            <div class="wrap">
                                <div class="inp">
                                    <p><input type="checkbox" class="ch" id="rem"  checked="checked" name="LoginForm[rememberMe]" value="1"/> <label for="rem">Remember me</label></p>
                                    <a href="/account/ForgotPassword" class="restore">Forgot password</a>
                                </div>
                                <a class="btn-login" style="cursor:pointer;" onclick ="document.forms.login.submit();">Login</a>
                            </div>
                        </div>
                    </form>


Mój kod:
Kod
<?php
$cookie_file = 'cookie.txt';

$c = curl_init('http://rapidgator.net/');
curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($c, CURLOPT_URL, 'http://rapidgator.net/auth/login');
curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12;");
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS,
'LoginForm[email]=xxx@gmail.com&LoginForm[password]=xxx123&LoginForm[rememberMe]=1');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_getinfo($c);
$s = curl_exec($c);
curl_close($c);
echo "Poszlo?";
print_r($s);

?>


Dlaczego ten kod nie działa, coś napisałem źle?
Go to the top of the page
+Quote Post
scanner
post
Post #2





Grupa: Zarząd
Postów: 3 503
Pomógł: 28
Dołączył: 17.10.2002
Skąd: Wrocław




Błędy jakieś?
Logi?
Komunikaty?
Fraszka?
Wierszyk może?


--------------------
scanner.info
Warto pamiętać: KISS, DRY
Go to the top of the page
+Quote Post
Watt
post
Post #3





Grupa: Zarejestrowani
Postów: 372
Pomógł: 1
Dołączył: 13.06.2008

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


Nic nie zwraca. Wypisuje "Poszło?", no bo wiadomo że przez echo i tyle. Dlatego właśnie zdzwiłem się i napisałem tutaj smile.gif
Uprzedzam pytania - login i hasło na pewno dobre.

Kod
print_r($s);

Powinien wypisać strone, a nie wypisuje nic

Ten post edytował Watt 5.09.2012, 11:29:53
Go to the top of the page
+Quote Post
scanner
post
Post #4





Grupa: Zarząd
Postów: 3 503
Pomógł: 28
Dołączył: 17.10.2002
Skąd: Wrocław




Zamiasst print_r daj vzar_dump() - może false ci zwraca?
Cytat
Returns TRUE on success or FALSE on failure. However, if the CURLOPT_RETURNTRANSFER option is set, it will return the result on success, FALSE on failure.


--------------------
scanner.info
Warto pamiętać: KISS, DRY
Go to the top of the page
+Quote Post
Watt
post
Post #5





Grupa: Zarejestrowani
Postów: 372
Pomógł: 1
Dołączył: 13.06.2008

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


vzar_dump - nie działa, może chodziło o var_dump?

var_dump wyrzuca:

Kod
Poszlo?string(0) ""
Go to the top of the page
+Quote Post
scanner
post
Post #6





Grupa: Zarząd
Postów: 3 503
Pomógł: 28
Dołączył: 17.10.2002
Skąd: Wrocław






U mnie jest inaczej smile.gif


--------------------
scanner.info
Warto pamiętać: KISS, DRY
Go to the top of the page
+Quote Post
nospor
post
Post #7





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




scanner a podałeś prawdziwe dane logowania? wink.gif


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

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 Aktualny czas: 20.08.2025 - 10:22