public function _exec() { parent::_exec(); if ($this->error) { throw new CurlException($this->curl->error_message, $this->curl->error_code); } }
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); }
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); }
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; }
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; }
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); }