Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][cURL] Logowanie i działanie na stronie
ptkb
post 20.11.2011, 16:45:30
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 21.03.2011

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


Witam,
Chce napisać skrypt który
- zaloguje się na stronie orange pl
- wejdzie do brami sms
- wpisze w forme dane ze zmiennych i wyśle wiadomosc na numer ze zmiennej

To co mam to:

  1. <?php
  2.  
  3. $c = curl_init();
  4. curl_setopt($c,CURLOPT_URL,'https://www.orange.pl/start.phtml?_DARGS=/gear/infoportal/header/user-box.jsp');
  5. curl_setopt($c,CURLOPT_POST,1);
  6. curl_setopt($c,CURLOPT_POSTFIELDS,'/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userLogin=MOJ_NUMER&/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userPassword=MOJE_HASLO');
  7.  
  8. curl_exec($c);
  9.  
  10. ?>


I zwraca mi tylko stronkę orange.pl (nie jestem zalogowany).

Wie ktoś jak to poprawić ?
Go to the top of the page
+Quote Post
toaspzoo
post 20.11.2011, 17:01:10
Post #2





Grupa: Zarejestrowani
Postów: 778
Pomógł: 84
Dołączył: 29.07.2010
Skąd: Gliwice / Pławniowice Mistrz niezmordowanej klawiatury.

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


?/pkt....


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

LS Easter egg <
Go to the top of the page
+Quote Post
ptkb
post 20.11.2011, 17:16:27
Post #3





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 21.03.2011

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


Cytat(toaspzoo @ 20.11.2011, 17:01:10 ) *
?/pkt....


No taka jest nazwa zmiennej, wiem dziwna ale zobacz źródło.
A dawanie ? przed nazwą nic nie daje.

Ten post edytował ptkb 20.11.2011, 17:18:53
Go to the top of the page
+Quote Post
cycofiasz
post 20.11.2011, 18:05:27
Post #4





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

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


Skąd wziąłeś parametry POST?
Go to the top of the page
+Quote Post
ptkb
post 20.11.2011, 19:39:04
Post #5





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 21.03.2011

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


ze źródła strony orange.pl

  1. <form action="https://www.orange.pl/start.phtml?_DARGS=/gear/infoportal/header/user-box.jsp" method="post" id="loginForm"><input value="UTF-8" type="hidden" name="_dyncharset"/><ul class="login-form"><li class="first"><label for="login-field">login lub nr telefonu</label><input value="" type="text" class="text" name="/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userLogin" id="login-field"/><input value=" " type="hidden" name="_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userLogin"/></li><li><label for="password-field">hasło</label><input value="" type="password" class="text" name="/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userPassword" id="password-field"/><input value=" " type="hidden" name="_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userPassword"/></li><li class="button"><input value="/start.phtml" type="hidden" name="/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.successUrl"/><input value=" " type="hidden" name="_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.successUrl"/><input value="/start.phtml" type="hidden" name="/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.errorUrl"/><input value=" " type="hidden" name="_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.errorUrl"/><input value="loguj" type="hidden" name="/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.login"/><input value=" " type="hidden" name="_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.login"/><ul class="links"><li><a class="gray-full-box" href="/portal/map/map/passwd_recovery" title="przypomnij mi hasło">przypomnij mi hasło</a></li><li><a class="gray-full-box" href="/portal/map/map/register?step=1" title="zarejestruj się">zarejestruj się</a></li></ul><input type="image" class="button" value="loguj" src="http://www.orange.pl/binaries-http/map/infoportal/button/zaloguj_sie.gif" title="zaloguj się"/></li></ul><input value="/gear/infoportal/header/user-box.jsp" type="hidden" name="_DARGS"/></form>



AKTUALIZACJA

Udało mi się exclamation.gif!

Logowanie mam za sobą teraz tylko, jak zrobić będąc zalogowanym przez cURL wejść do następnego skryptu i przesłać mu formę ?

Przykładowo Logujemy się w index.php (pomyślnie) a chcemy przejść zalogowani do skryptsms.php i wysłać mu formę.

Wiecie jak to zrobićquestionmark.gif

Aha wkleje kod do logowania się na orange

  1. <?php
  2.  
  3. $c = curl_init();
  4. curl_setopt($c,CURLOPT_URL,'https://www.orange.pl/start.phtml?_DARGS=/gear/infoportal/header/user-box.jsp');
  5. //curl_setopt($c, CURLOPT_HEADER, 1);
  6. curl_setopt($c, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cook.txt');
  7. curl_setopt($c, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cook.txt');
  8. curl_setopt($c,CURLOPT_POSTFIELDS,'_dyncharset=UTF-8&/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userLogin=NUMER_TELEFONU&_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userLogin=%20&/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userPassword=MOJE_HATLO&_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.userPassword=%20&/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.successUrl=/start.phtml&_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.successUrl=%20&/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.errorUrl=/start.phtml&_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.errorUrl=%20&/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.login=loguj&_D:/ptk/map/infoportal/portlet/header/formhandler/ProxyProfileFormhandler.login=%20&_DARGS=/gear/infoportal/header/user-box.jsp');
  9. curl_setopt($c,CURLOPT_POST,1);
  10.  
  11. curl_exec($c);
  12. ?>


Ten post edytował ptkb 20.11.2011, 20:02:07
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: 29.06.2025 - 14:22