44 $token = $this->settings[
"serviceUserToken"];
47 curl_setopt_array($curl, array(
48 CURLOPT_URL => $this->settings[
"domain"] .
"/v2beta/users/$this->userid/phone",
49 CURLOPT_RETURNTRANSFER =>
true,
50 CURLOPT_ENCODING =>
'',
51 CURLOPT_MAXREDIRS => 10,
53 CURLOPT_FOLLOWLOCATION =>
true,
54 CURLOPT_CUSTOMREQUEST =>
'POST',
55 CURLOPT_POSTFIELDS =>
"{
56 \"phone\": \"$phone\",
59 CURLOPT_HTTPHEADER => array(
60 "Content-Type: application/json",
61 "Accept: application/json",
62 "Authorization: Bearer $token"
66 $response = json_decode(curl_exec($curl));
68 if(isset($response->code)) {
69 throw new Exception(
"Error-Code: " . $response->code .
" Message: " . $response->message);
71 $this->returnedVerificationCode = $response->verificationCode;
80 $token = $this->settings[
"serviceUserToken"];
81 curl_setopt_array($curl, array(
82 CURLOPT_URL => $this->settings[
"domain"] .
"/v2beta/users/$this->userid/phone/resend",
83 CURLOPT_RETURNTRANSFER =>
true,
84 CURLOPT_ENCODING =>
'',
85 CURLOPT_MAXREDIRS => 10,
87 CURLOPT_FOLLOWLOCATION =>
true,
88 CURLOPT_CUSTOMREQUEST =>
'POST',
89 CURLOPT_POSTFIELDS =>
'{
92 CURLOPT_HTTPHEADER => array(
93 "Content-Type: application/json",
94 "Accept: application/json",
95 "Authorization: Bearer $token"
99 $response = json_decode(curl_exec($curl));
100 $this->returnedVerificationCode = $response->verificationCode;
108 public function verify(
string $verifyCode): bool {
109 $token = $this->settings[
"serviceUserToken"];
112 curl_setopt_array($curl, array(
113 CURLOPT_URL => $this->settings[
"domain"] .
"/v2beta/users/$this->userid/phone/verify",
114 CURLOPT_RETURNTRANSFER =>
true,
115 CURLOPT_ENCODING =>
'',
116 CURLOPT_MAXREDIRS => 10,
117 CURLOPT_TIMEOUT => 0,
118 CURLOPT_FOLLOWLOCATION =>
true,
119 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
120 CURLOPT_CUSTOMREQUEST =>
'POST',
121 CURLOPT_POSTFIELDS =>
"{
122 \"verificationCode\": \"$verifyCode\"
124 CURLOPT_HTTPHEADER => array(
125 "Content-Type: application/json",
126 "Accept: application/json",
127 "Authorization: Bearer $token"
131 $response = curl_exec($curl);
133 if(isset($response->code)) {