Advertisement
Guest User

Untitled

a guest
Nov 9th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.94 KB | None | 0 0
  1. <?php
  2. /**
  3.  * User: krch_Vova
  4.  * Date: 07.11.2016
  5.  */
  6. class jokerAPI
  7. {
  8.     public $username = 'krch_Vova';
  9.     public $password = 'zpc0je11';
  10.  
  11.     public function getCURLResponse($link)
  12.     {
  13.         $curl = curl_init();
  14.         curl_setopt($curl, CURLOPT_URL, $link);
  15.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  16.         $return = curl_exec($curl);
  17.         curl_close($curl);
  18.         return $return;
  19.     }
  20.  
  21.     /**
  22.      * @return string
  23.      */
  24.     public function login()
  25.     {
  26.         $return = $this->getCURLResponse('https://dmapi.joker.com/request/login?username='.$this->username.'&password='.$this->password.'');
  27.         return $return;
  28.     }
  29.  
  30.     /**
  31.      * @return array
  32.      */
  33.     public function cuteAuthData()
  34.     {
  35.         $str = $this->login();
  36.         $line = explode("\n", $str);
  37.         $SvTrId = substr($line[0], 8); // SvTrId
  38.         $UID = substr($line[5], 5); // UID
  39.         $AuthSid = str_replace('Auth-Sid: ', '', $line[7]); // Auth-Sid
  40.         $return = array('UID' => $UID, 'AuthSid' => $AuthSid, 'SvTrId' => $SvTrId);
  41.  
  42.         return $return;
  43.     }
  44.  
  45.     /**
  46.      * @return array
  47.      */
  48.     public function queryProfile()
  49.     {
  50.         $cuteAuthData = $this->cuteAuthData();
  51.         $return = $this->getCURLResponse('https://dmapi.joker.com/request/query-profile?auth-sid='.$cuteAuthData['AuthSid']);
  52.         return $return;
  53.     }
  54.  
  55.     public function domainRegister($domain, $period, $owner, $billing, $admin, $tech, $nsList)
  56.     {
  57.         $cuteAuthData = $this->cuteAuthData();
  58.         $return = $this->getCURLResponse('https://dmapi.joker.com/request/domain-register?domain='.$domain.'&period='.$period.'&status=production&owner-c='.$owner.'&billing-c='.$billing.'&admin-c='.$admin.'&tech-c='.$tech.'&ns-list='.$nsList.'&auth-sid='.$cuteAuthData['AuthSid'].'');
  59.         var_dump($return);
  60.     }
  61.    
  62.  
  63.     public function contactCreate($tld, $name, $email, $address, $city, $postalCode, $country, $phone)
  64.     {
  65.         $cuteAuthData = $this->cuteAuthData();
  66.         $return = $this->getCURLResponse('https://dmapi.joker.com/request/contact-create?tld='.$tld.'&name='.$name.'&email='.$email.'&address-1='.$address.'&city='.$city.'&postal-code='.$postalCode.'&country='.$country.'&phone='.$phone.'&auth-sid='.$cuteAuthData['AuthSid']);
  67.         return $return;
  68.     }
  69.  
  70.  
  71.     public function queryContactList()
  72.     {
  73.         $cuteAuthData = $this->cuteAuthData();
  74.         $response = $this->getCURLResponse('https://dmapi.joker.com/request/query-contact-list?pattern=*&tld=net&auth-sid='.$cuteAuthData['AuthSid']);
  75.         $ex = explode("\n", $response);
  76.         $data = [];
  77.         foreach(array_filter($ex) as $v) {
  78.             $v = explode(': ', $v);
  79.             if(count($v) === 2) {
  80.                 $data[mb_strtolower(trim($v[0]))] = trim($v[1]);
  81.             } else {
  82.                 $data['contact'][] = trim($v[0]);
  83.             }
  84.         }
  85.         return $data;
  86.     }
  87. }
  88.  
  89. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement