Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [CURL] problem w logowaniu do ogame
lucashp
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 3.07.2009

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


Witam,
Chciałbym zalogować się na ogame, mam skrypcik ale cały czas dostaje info ze sesja jest nie ważna.
Podejrzewam że jakaś opcja może być źle ustawiona, może cookies?

widziałem że na forum też ktoś sie już z podobnym problem zmagał ale nic to nie daje.
http://forum.php.pl/index.php?showtopic=11...rt=#entry569704

Jeśli ktoś miałby czas zobaczyć co jest nie tak to dane do konta są ok// uni1, kontotestowe, haslo123

  1. <?php
  2.  
  3.    $cookiefile = tempnam("tmp", "cookies_");
  4.    
  5.    $login_url='http://www.ogame.onet.pl/?kid=0-00111-03311-0707-01207103';
  6.    $login_post_url='http://s1.ogame.onet.pl/game/index.php?page=overview&lgn=1';
  7.    
  8.    $username = "kontotestowe";
  9.    $password = "haslo123";
  10.    
  11.    $agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";    
  12.  
  13.    $ch = curl_init();
  14.    curl_setopt($ch, CURLOPT_URL, $login_url);
  15.    
  16.    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  17.    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  18.    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);    
  19.    
  20.    // cos tu nie tak?
  21.    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
  22.    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
  23.    curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
  24.    
  25.    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
  26.    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  27.    
  28.    $result = curl_exec ($ch);
  29.    curl_close ($ch);
  30.    
  31.    
  32.    // po uzyskaniu cookie jeszcze raz sie laczymy
  33.    $postfields = array('v' => '2', 'universe' => 's1.ogame.onet.pl', 'login' => 'kontotestowe', 'pass' => 'haslo123', 'button.x' => '0', 'button.y' => '0');
  34.    $reffer = $login_url;
  35.    
  36.    $ch = curl_init();    
  37.    curl_setopt($ch, CURLOPT_URL, $login_post_url);
  38.    
  39.    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  40.    curl_setopt($ch, CURLOPT_POST, 1);
  41.    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
  42.    
  43.    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  44.    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  45.    curl_setopt($ch, CURLOPT_REFERER, $reffer);
  46.        
  47.    // cos tu nie tak?
  48.    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
  49.    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);    
  50.    curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
  51.    
  52.    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
  53.    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  54.    
  55.    $result = curl_exec ($ch);
  56.    
  57.    echo $result;    
  58.    curl_close ($ch);
  59.  
  60. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
erix
post
Post #2





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Nie pomagamy w pisaniu botów. Grasz? Graj zgodnie z regulaminem.
Go to the top of the page
+Quote Post

Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.12.2025 - 00:39