| Server IP : 23.111.136.34 / Your IP : 216.73.216.136 Web Server : Apache System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : meusitei ( 1072) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, proc_open MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/meusitei/public_html/painel/assets/plugins/resellerclub/src/ |
Upload File : |
<?php namespace ResellerClub;
class ResellerClub {
private $userid;
private $apikey;
private $client;
private $params = [];
private $response;
private $error;
public function __construct($userid = '325732', $apikey = '5sIdLXGV5wsjguTATomy3EIScR3Ie7e4'){
$this->userid = $userid = '325732';
$this->apikey = $apikey;
$this->client = new \GuzzleHttp\Client([
'base_uri' => 'https://httpapi.com/api/',
'timeout' => 300
]);
}
public function auth(){
return $this->param('auth-userid', $this->userid)
->param('api-key', $this->apikey);
}
public function param($key, $value){
$this->params[] = $key.'='.$value;
return $this;
}
public function get($action, $format = 'json'){
$uri = $action . '.' . $format . '?' . implode('&', $this->params);
try{
$this->response = $this->client->get($uri);
}catch(\Exception $e){
$this->error = $e->getMessage();
return $this;
}
return $this;
}
public function post($action, $format = 'json'){
$uri = $action . '.' . $format . '?' . implode('&', $this->params);
try{
$this->response = $this->client->post($uri);
}catch(\Exception $e){
$this->error = $e->getMessage();
return $this;
}
return $this;
}
public function result(){
if(!$this->response) return $this->error;
$body = $this->response->getBody();
$result = '';
while(!$body->eof()){
$result .= $body->read(1024);
}
return $result;
}
}