par
ferv21 » 15 août 2010, 19:52
Heuu pour l'instant je me suis simplement logué sur le site ogame, en envoyant les données avec la méthode POST rien de plus ...
index.php
require_once 'ogame.php';
$bot = new Ogame ();
$bot->site = 'xxxxxxxxxxxxxx';
$bot->identification = array(
'v' => xxx,
'is_utf8' => xxxx,
'uni_url' =>'xxxxxxxxxxxxxx',
'login' =>'xxxx',
'pass' =>'xxxx,);
$bot->startCurl();
$bot->auth();
echo htmlentities($bot->execute());
$bot->end();
ogame.php
<?php
/**
* @author def
* @copyright 2010
*/
class Ogame{
public
$site = '',
$identification = '';
private $session = '',
$data = '';
public function __construct(){
}
public function startCurl(){
$this->session = curl_init();
}
public function auth(){
curl_setopt($this->session, CURLOPT_HEADER ,1);
curl_setopt($this->session, CURLOPT_URL ,$this->site);
curl_setopt($this->session, CURLOPT_POST ,true);
curl_setopt($this->session, CURLOPT_POSTFIELDS ,$this->identification);
curl_setopt($this->session, CURLOPT_COOKIEJAR ,realpath('cookie.txt'));
curl_setopt($this->session, CURLOPT_COOKIESESSION ,true);
curl_setopt($this->session, CURLOPT_FOLLOWLOCATION ,true);
curl_setopt($this->session, CURLOPT_RETURNTRANSFER ,true);
curl_setopt($this->session, CURLOPT_HTTPHEADER , Array("Content-Type:application/xml"));
}
public function execute(){
$this->data = curl_exec($this->session);
return $this->data;
}
public function getCurrentUrl(){
$info = curl_getinfo($this->session);
$this->url = $info['url'];
return $this->url;
}
public function end(){
curl_close($this->session);
}
}
?>
Heuu pour l'instant je me suis simplement logué sur le site ogame, en envoyant les données avec la méthode POST rien de plus ...
index.php
[php]require_once 'ogame.php';
$bot = new Ogame ();
$bot->site = 'xxxxxxxxxxxxxx';
$bot->identification = array(
'v' => xxx,
'is_utf8' => xxxx,
'uni_url' =>'xxxxxxxxxxxxxx',
'login' =>'xxxx',
'pass' =>'xxxx,);
$bot->startCurl();
$bot->auth();
echo htmlentities($bot->execute());
$bot->end();[/php]
ogame.php
[php]<?php
/**
* @author def
* @copyright 2010
*/
class Ogame{
public
$site = '',
$identification = '';
private $session = '',
$data = '';
public function __construct(){
}
public function startCurl(){
$this->session = curl_init();
}
public function auth(){
curl_setopt($this->session, CURLOPT_HEADER ,1);
curl_setopt($this->session, CURLOPT_URL ,$this->site);
curl_setopt($this->session, CURLOPT_POST ,true);
curl_setopt($this->session, CURLOPT_POSTFIELDS ,$this->identification);
curl_setopt($this->session, CURLOPT_COOKIEJAR ,realpath('cookie.txt'));
curl_setopt($this->session, CURLOPT_COOKIESESSION ,true);
curl_setopt($this->session, CURLOPT_FOLLOWLOCATION ,true);
curl_setopt($this->session, CURLOPT_RETURNTRANSFER ,true);
curl_setopt($this->session, CURLOPT_HTTPHEADER , Array("Content-Type:application/xml"));
}
public function execute(){
$this->data = curl_exec($this->session);
return $this->data;
}
public function getCurrentUrl(){
$info = curl_getinfo($this->session);
$this->url = $info['url'];
return $this->url;
}
public function end(){
curl_close($this->session);
}
}
?>[/php]