Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP][cURL] Logowanie i działanie na stronie
Forum PHP.pl > Forum > Przedszkole
ptkb
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ć ?
toaspzoo
?/pkt....
ptkb
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.
cycofiasz
Skąd wziąłeś parametry POST?
ptkb
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. ?>
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.