Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> pomoc przy skrypcie otwierajacym logowane stronki?, raczej malo doswiadczenia... z php
kasi....
post 24.02.2006, 19:40:58
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 23.02.2006

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


witam

chcial bym napisac skrypt ktory by otwieral polaczenie ze stronka logowal sie na niej.... pozniej odczytywal dane ze strony i wysylal mi to np na poczte....

znalazlem:

http://pl.php.net/curl
http://pl.php.net/fopen
http://pl.php.net/manual/pl/function.fsockopen.php

ale z uzyciem mam juz maly problem...
raczej nigdy w zyciu nie pisalem w php i tu jest caly problem
ale znam asrmblera winksmiley.jpg troche c+


a z php?
zainstalowalem programik php Webpage Editor i zaczalem pisac takie male skryptu ale jeszcze do czegos takiego nie doszedlem winksmiley.jpg)

chcial bym zeby jakis dobry cierpliwy czlowiek mi pomogl napisc taki skrypt smile.gif) hehee

albo zeby mi ktos cos podobnego napisal byl bym bardzo wdzieczny, mogl bym nawet zaplacic takiej osobie jakby dzialal dobrze winksmiley.jpg) skrypt


pozdrawiam i z gory dziekuje smile.gif
Go to the top of the page
+Quote Post
hwao
post 24.02.2006, 22:18:17
Post #2


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




http://repository.hwao.be/subdomains/repos...quest.class.php

Takie cos kiedys napisalem i dzialalo smile.gif

wysylasz dane wpier do logowania postem (pewnie tak trzeba), jestes zalogowany lapiesz cookie, albo co tam zwraca robisz 2 request z tymi danymi co Ci sa potrzebne i pobierasz co chcesz.
Metoda Ci zwraca caly dokument, uzyj tam wyrazen regularnych i wybierz co Ci trzeba
Go to the top of the page
+Quote Post
chomiczek
post 24.02.2006, 22:57:58
Post #3





Grupa: Zarejestrowani
Postów: 271
Pomógł: 4
Dołączył: 5.01.2005

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


Hmm.. ja też używam czegoś takiego.. loguje się.. pobieram dane z kodu i odpowiednio je przetwarzam.. a potem umieszczam u siebie w bazie.. i na końcu dowolnie juz operuje na tym co mam w bazie


--------------------
created by chomiczek
Go to the top of the page
+Quote Post
kasi....
post 24.02.2006, 23:09:16
Post #4





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 23.02.2006

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


hehee kolego Hwao winksmiley.jpg
stronka jest oki juz powinno byc mi latwiej smile.gif)



ps. gram w oGame smile.gif
szkoda ze jest taki punkt regulaminu §3
Go to the top of the page
+Quote Post
hwao
post 25.02.2006, 08:13:48
Post #5


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




pisałem "api" do ogame, ale zaprzestałem i rozwijal to dalej xardas' zapytaj go bo mial chyba sporo z tego co mi pokazywal smile.gif
Go to the top of the page
+Quote Post
kasi....
post 25.02.2006, 13:58:56
Post #6





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 23.02.2006

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


witam poraz kolejny

maly problem na poczatku z prawie gotowym skryptem smile.gif

http://repository.hwao.be/subdomains/repos...quest.class.php

Kod
   class httpRequest {
        protected $Socket = null;     //tu mi wyskakuje blad co tu trzeba wpisac?
        
        protected $bUserProxy = false;
        protected $sProxy     = '';
        protected $iProxyPort = 80;

no i dalej bedzie prwnie to samo
Kod
     protected $sReferer   = null;
        
        
        protected $sUrl          = '';
        protected $sServer       = '';
        protected $sServerScheme = '';
        protected $iServerPort   = '';
        protected $iTime         = 0;


co jest co? bo sie nie moge polapac??
Go to the top of the page
+Quote Post
hwao
post 25.02.2006, 15:16:15
Post #7


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




Tu masz tylko Request czyli zadanie smile.gif w tej kategori po lewej znajdowalo sie jeszcze tak:
Socket/Gniazdo - odpowiedzialne za utowrzenie "polaczenia" musisz to miec sciagniete i zalaczone
Response/Analiza odpowiedzi - analizuje co zwraca zadanie

I wtedy Ci ruszy:)
Go to the top of the page
+Quote Post
kasi....
post 27.02.2006, 09:33:36
Post #8





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 23.02.2006

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


witam

poraz kolejny winksmiley.jpg

zaczalem na przykladzie ogame

zrobielm pliki
jak w

http://repository.hwao.be/subdomains/repos...ogame/start.php

Kod
    include( './ogame.class.php' );
    include( './httpRequest.class.php' );
    include( './httpResponse.class.php' );
    include( './Socket.class.php' );


no i mi sie pokazuje blad



Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in f:\zabawki\php\ogame.class.php on line 4

linia nr.4 w ogame.class.php
Kod
        private $sServerIp  = '';


pozniej






Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in f:\zabawki\php\httpRequest.class.php on line 26

linia nr.26 w httpRequest.class.php
Kod
        protected $Socket = null;







Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in f:\zabawki\php\httpResponse.class.php on line 4

linia nr.4 w httpResponse.class.php
Kod
        protected $Socket = null;







Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' f:\zabawki\php\Socket.class.php on line 7

linia nr.7 w Socket.class.php
Kod
        protected $sNewLine = "\n";



dlaczego to jest?


aha i po co tam jest index questionmark.gif po lewej?
http://repository.hwao.be/subdomains/repos...ogame/index.php
questionmark.gif to mi chyba nie bedzie potrzebne?
Go to the top of the page
+Quote Post
hwao
post 27.02.2006, 15:22:20
Post #9


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




Nie nie bedzie Ci potrzeby ten plik (przypadkiem tam wrzucilem:) )

Co do problemu, potrzebne jest php5 zeby to odpalic jezeli masz php5 to Ci napisze na szybko jakis prosty dzialajacy przyklad.
Go to the top of the page
+Quote Post
kasi....
post 27.02.2006, 17:37:30
Post #10





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 23.02.2006

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


zainstalowalem dokladnie nawet moge nazwe wklaic winksmiley.jpg "php-5.1.2-installer"

napisalem taki skrypcik co przekitrowywuje i otwiera strony ale nie wiem jak Cookie odpalic, jak otworzyc sesje, no i to logowanie smile.gif

pozdrawiam
Go to the top of the page
+Quote Post
hwao
post 4.03.2006, 19:50:49
Post #11


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




Aktualnie nie mam czasu, jak troche znajde to napisze...
Tzn napisze Ci do mometu zalogowania sie? dalej sobie zrobisz analogiczni co chcesz...

Jak chcesz szybciej to mozesz probowac zlapac Xardas'a...

Wogole to najlepiej bedzie jak mi sie przypomnisz na gg bo inaczej moge zapomniec:)
Go to the top of the page
+Quote Post
xardas
post 4.03.2006, 19:55:27
Post #12





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 7.03.2004

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


ogame.class.php
  1. <?php
  2.  
  3.     class oGame {
  4.         private $sServerIp  = '';
  5.         private $sSessionId = null;
  6.         private $sReferer = null;
  7.         
  8.         public function __construct( $sServerIp ) {
  9.             $this->sServerIp = $sServerIp;
  10.             
  11.         }
  12.         public function getSid()
  13.         {
  14.             return( $this -> sSessionId );
  15.         }
  16.         
  17.         public function isLogin() {
  18.             return !is_null( $this->sSessionId );
  19.         }
  20.         
  21.         public function sPage( $strPage, $arrParams = array(), $arrPost = array() )
  22.         {
  23.             $url = 'http://'.$this->sServerIp.'/game/'. $strPage;
  24.             $r = new httpRequest( $url );
  25.             $arrGet = array(
  26.                 'session' => $this -> getSid(),
  27.                 'PHPSESSID' => $this -> getSid()
  28.                 );
  29.             $arrGet = array_merge( $arrParams, $arrGet );
  30.             $r -> get( $arrGet );
  31.             
  32.             $r -> post( $arrPost );
  33.  
  34.             $re = new httpResponse( $r -> send() );
  35.             return $re;
  36.         }
  37.  
  38.         public function page()
  39.         {
  40.             $url = 'http://'.$this->sServerIp.'/game/index.php';
  41.             $r = new httpRequest( $url );
  42.             $r -> get( array(
  43.                 'session' => $this -> getSid()
  44.                 ));
  45.  
  46.             $re = new httpResponse( $r -> send() );
  47.             return $re;
  48.         }
  49.         public function login( $sLogin, $sPass ) {
  50.             try {
  51.             $url = 'http://'.$this->sServerIp.'/game/reg/login2.php';
  52.             //$url = 'http://www.php.pl/';
  53.             $r = new httpRequest( $url );
  54.             //$r->proxy( '10.1.1.1', 80 );
  55.             $r->post( array(
  56.                 'timestamp' => time(),
  57.                 'v' => 2,
  58.                 'Uni' => $this->sServerIp,
  59.                 'login' => $sLogin,
  60.                 'pass' => $sPass,
  61.                 'x' => 0,
  62.                 'y' => 0,
  63.                 
  64.                 )
  65.             );
  66.             $re = new httpResponse( $r->send() );
  67.             
  68.             
  69.             
  70.             $strDoc = $re->getDocument();
  71.             
  72.             preg_match( '#index\.php\?session=(.*?)"#si', $strDoc, $arrOut );
  73.             $this -> sSessionId = $arrOut[1];
  74.             
  75.             }
  76.             catch ( Exception $e ) {
  77.                 throw $e;
  78.             }
  79.             
  80.         }
  81.         
  82.     }
  83.     
  84. ?>    

start.php
  1. <?php
  2. include( './ogame.class.php' );
  3. include( './httpRequest.class.php' );
  4. include( './httpResponse.class.php' );
  5. include( './Socket.class.php' );
  6. $ogame = new Ogame( 'ogame185.de' );
  7. $ogame -> login( 'user', 'pass' );
  8. if( $ogame->isLogin() ) 
  9.     {
  10.  
  11.         
  12.     
  13.         function loadPage( ogame $objOgame, $strPage = 'overview.php', $arrParams = array(), $arrPost = array() )
  14.         {
  15.         
  16.             $page = $objOgame -> sPage( $strPage, $arrParams,  $arrPost );
  17.  
  18.             
  19.             $strDoc = $page -> getDocument();
  20.             $strDoc = str_replace( '<script language=JavaScript> if (parent.frames.length == 0) { top.location.href = "http://www.ogame.de/"; } </script>', '', $strDoc );
  21.             return $strDoc;
  22.             
  23.             
  24.         }
  25.     }
  26.     if( is_callable( 'loadPage' ) )
  27.     {
  28.                 $strOverview = loadPage( $ogame, 'overview.php', array( 'mode' => '', 'cp' => 33701844, 'messageziel' => '', 're' => '' ) );
  29.                    ///dalsza obróbka
  30. }
  31. }
  32.  
  33. ?>

Na prośbe hwao winksmiley.jpg
Edit: Zgodnie z pierwszym postem -> darowizny chętnie przyjmę na 50102055581111146337800021 tongue.gif

Ten post edytował xardas 4.03.2006, 19:58:31
Go to the top of the page
+Quote Post
kasi....
post 5.03.2006, 14:45:28
Post #13





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 23.02.2006

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


hehee witam

jeszcze nie sprawdzalem czy dziala bo
padl mi system znaczy system
windows ciezko nazwac systemem tongue.gif
zajechal sie tongue.gif hehee
zainstalowalem sobie win xp i linuxa smile.gif nareszcie nie musze siedziec na shicie


a co do darowizmy smile.gif) winksmiley.jpg to jak cos to ile tam moge dac za takie cos? winksmiley.jpg bo nigdy nie placilem za skrypty hehee
?
Go to the top of the page
+Quote Post
xardas
post 5.03.2006, 15:10:54
Post #14





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 7.03.2004

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


Co łaska winksmiley.jpg Ale mniej jak 20 to się na tacę nie daje, hm? winksmiley.jpg W końcu katolicki kraj mamy biggrin.gif
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: 28.06.2025 - 02:13