Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> pomoc przy skrypcie otwierajacym logowane stronki?, raczej malo doswiadczenia... z php
kasi....
post
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 (IMG:http://forum.php.pl/style_emoticons/default/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 (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg) )

chcial bym zeby jakis dobry cierpliwy czlowiek mi pomogl napisc taki skrypt (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) ) hehee

albo zeby mi ktos cos podobnego napisal byl bym bardzo wdzieczny, mogl bym nawet zaplacic takiej osobie jakby dzialal dobrze (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg) ) skrypt


pozdrawiam i z gory dziekuje (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
xardas
post
Post #2





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 (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Edit: Zgodnie z pierwszym postem -> darowizny chętnie przyjmę na 50102055581111146337800021 (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)

Ten post edytował xardas 4.03.2006, 19:58:31
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: 6.10.2025 - 04:22