예제 #1
0
 public function _exec()
 {
     parent::_exec();
     if ($this->error) {
         throw new CurlException($this->curl->error_message, $this->curl->error_code);
     }
 }
예제 #2
0
 public function update($c_id, $fname = '', $mname = '', $lname = '', $gen = '', $avatar = '', $addl1 = '', $addl2 = '', $city = '', $state = '', $country = '', $zip = '', $dob = '')
 {
     $curl = new Curl();
     $curl->setopt(CURLOPT_URL, "https://v2.api.xapo.com/customers/{$c_id}/?first_name={$fname}middle_name={$mname}&last_name={$lname}&gender={$gen}&avatar={$avatar}&address_line_1={$addl1}&address_line_2={$addl2}&city={$city}&state={$state}&country_iso3={$country}&zip_code={$zip}&date_of_birth={$dob}");
     $curl->setopt(CURLOPT_RETURNTRANSFER, true);
     $curl->setopt(CURLOPT_HEADER, false);
     $curl->setopt(CURLOPT_CUSTOMREQUEST, 'PATCH');
     $curl->_exec();
     $response = $curl->response;
     $curl->close();
     return json_decode($response);
 }
예제 #3
0
 public function prim_address($token, $acc_id)
 {
     $curl = new Curl();
     $curl->setopt(CURLOPT_URL, "https://v2.api.xapo.com/accounts/{$acc_id}/primary_address/");
     $curl->setopt(CURLOPT_RETURNTRANSFER, true);
     $curl->setopt(CURLOPT_HEADER, false);
     $curl->setopt(CURLOPT_HTTPHEADER, ["Authorization: Bearer {$token}"]);
     $curl->_exec();
     $curl->close();
     $response = $curl->response;
     return json_decode($response);
 }
예제 #4
0
 public function disable($token, $id)
 {
     $curl = new Curl();
     $curl->setopt(CURLOPT_URL, "https://v2.api.xapo.com/webhooks/{$id}/disable");
     $curl->setopt(CURLOPT_RETURNTRANSFER, true);
     $curl->setopt(CURLOPT_HEADER, false);
     $curl->setopt(CURLOPT_POST, true);
     $curl->setopt(CURLOPT_HTTPHEADER, ["Authorization: Bearer {$token}"]);
     $curl->_exec();
     $response = $curl->response;
     $curl->close();
     return $response;
 }
예제 #5
0
파일: Token.php 프로젝트: fmedeiros95/xapo
 public function new($redirect_uri)
 {
     $curl = new Curl();
     $curl->setopt(CURLOPT_RETURNTRANSFER, true);
     $curl->setopt(CURLOPT_HEADER, false);
     $curl->setopt(CURLOPT_URL, 'https://v2.api.xapo.com/oauth2/token');
     $curl->setopt(CURLOPT_POST, true);
     $curl->setopt(CURLOPT_POSTFIELDS, "grant_type=client_credentials&redirect_uri={$redirect_uri}");
     $curl->setopt(CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded', "Authorization: Basic {$this->hash}"]);
     $curl->_exec();
     $curl->close();
     return json_decode($curl->response)->access_token;
 }
예제 #6
0
 public function update($token, $addr, $amount)
 {
     $curl = new Curl();
     $curl->setopt(CURLOPT_URL, "https://v2.api.xapo.com/addresses/{$addr}?payment_threshold={$amount}");
     $curl->setopt(CURLOPT_RETURNTRANSFER, true);
     $curl->setopt(CURLOPT_HEADER, false);
     $curl->setopt(CURLOPT_CUSTOMREQUEST, 'PATCH');
     $curl->setopt(CURLOPT_POSTFIELDS, ['payment_threshold' => $amount]);
     $curl->setopt(CURLOPT_HTTPHEADER, ["Authorization: Bearer {$token}"]);
     $curl->_exec();
     $response = $curl->response;
     $curl->close();
     return json_decode($response);
 }