Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * User: krch_Vova
- * Date: 07.11.2016
- */
- class jokerAPI
- {
- public $username = 'krch_Vova';
- public $password = 'zpc0je11';
- public function getCURLResponse($link)
- {
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $link);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- $return = curl_exec($curl);
- curl_close($curl);
- return $return;
- }
- /**
- * @return string
- */
- public function login()
- {
- $return = $this->getCURLResponse('https://dmapi.joker.com/request/login?username='.$this->username.'&password='.$this->password.'');
- return $return;
- }
- /**
- * @return array
- */
- public function cuteAuthData()
- {
- $str = $this->login();
- $line = explode("\n", $str);
- $SvTrId = substr($line[0], 8); // SvTrId
- $UID = substr($line[5], 5); // UID
- $AuthSid = str_replace('Auth-Sid: ', '', $line[7]); // Auth-Sid
- $return = array('UID' => $UID, 'AuthSid' => $AuthSid, 'SvTrId' => $SvTrId);
- return $return;
- }
- /**
- * @return array
- */
- public function queryProfile()
- {
- $cuteAuthData = $this->cuteAuthData();
- $return = $this->getCURLResponse('https://dmapi.joker.com/request/query-profile?auth-sid='.$cuteAuthData['AuthSid']);
- return $return;
- }
- public function domainRegister($domain, $period, $owner, $billing, $admin, $tech, $nsList)
- {
- $cuteAuthData = $this->cuteAuthData();
- $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'].'');
- var_dump($return);
- }
- public function contactCreate($tld, $name, $email, $address, $city, $postalCode, $country, $phone)
- {
- $cuteAuthData = $this->cuteAuthData();
- $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']);
- return $return;
- }
- public function queryContactList()
- {
- $cuteAuthData = $this->cuteAuthData();
- $response = $this->getCURLResponse('https://dmapi.joker.com/request/query-contact-list?pattern=*&tld=net&auth-sid='.$cuteAuthData['AuthSid']);
- $ex = explode("\n", $response);
- $data = [];
- foreach(array_filter($ex) as $v) {
- $v = explode(': ', $v);
- if(count($v) === 2) {
- $data[mb_strtolower(trim($v[0]))] = trim($v[1]);
- } else {
- $data['contact'][] = trim($v[0]);
- }
- }
- return $data;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement