with http domain, it works, returning the expected output but with https, headers are null. Below is my attempt.
POST CURL
$fields = [];
$headers = ['_token: 58SkLjsNMk0', 'Authorization: 6059DLaf39d4141' ];
$cURLConnection = curl_init('<https domain>/api/auth/check');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $fields);
curl_setopt($cURLConnection, CURLOPT_HTTPHEADER,$headers);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($cURLConnection);
curl_close($cURLConnection);
dd($res);
Middleware
<?php
namespace App\Http\Middleware;
use Closure;
class Api
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next){
return response()->json($request->header('Authorization'));
}
}
Any help, suggestions is greatly appreciated. Thanks in advance.