$url, 'password' => config('env.logifuture_token')]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx', ]); } else { /************************************************* * DIRECT *************************************************/ if ($debug) { Notice::note('AUTH direct'.PHP_EOL.$url, 'b'); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'username' => 'nuhodds', 'password' => config('env.logifuture_token'), ])); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'accept: application/json', 'content-type: application/json', ]); } $file = curl_exec($ch); $data = json_decode($file, true); $header = []; $header[] = 'Authorization: Bearer '.$data['token']; $header[] = 'accept: application/json'; $header[] = 'content-type: application/json'; Logifuture::$auth_header = $header; } }