Muhammad Sulaiman Yusuf
2 years ago
4 changed files with 40 additions and 41 deletions
@ -0,0 +1,32 @@
|
||||
<?php |
||||
|
||||
namespace App\Helpers; |
||||
|
||||
|
||||
class MasterFunctionsHelper { |
||||
|
||||
|
||||
public static function curlReq($url, $token = ""){ |
||||
if(!$token) |
||||
$token = config('api.adw_token'); |
||||
|
||||
$ch = curl_init(); |
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url); |
||||
$headers = [ |
||||
'Authorization: '.$token |
||||
]; |
||||
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); |
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
||||
curl_setopt($ch, CURLOPT_VERBOSE, true); |
||||
curl_setopt($ch, CURLOPT_STDERR, fopen('php://stderr', 'w')); |
||||
|
||||
$output = curl_exec($ch); |
||||
curl_close($ch); |
||||
|
||||
return json_decode($output); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue