public function auth_day(){ $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dev.greatdayhr.com/api/auth/login', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "accessKey": "6b01ca39-94e9-4a4d-8011-6b3592a89c0c", "accessSecret": "$2a$10$wV8KvaAYnMvdDXO8zX/BWerKsopw2ZhjZhNyGlxcDZTp93qndDYOG" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); return $response; } public function auth_week(){ $auth_day = $this->auth_day(); $jsondata = json_decode($auth_day); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dev.greatdayhr.com/api/auth/refresh', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "refreshToken": "'.$jsondata->refresh_token.'" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); return $response; }