Tested as described in this Stack post: Not working on Laravel Controller, Working on Tinker
The original is a very simple CURL request:
curl -H "Authorization: Bearer 1G5bv.m*******"
-H "Content-Type: application/json"
-X POST https://testdashboard.com/api/reporting/314****/6912****/submit/202314*****
I used the Laravel Http facade (also tried native PHP curl with same result). With a var_dump
before the URL is exact, and the token is correct.
$response = Http::withHeaders([
'Authorization' => 'Bearer '.$this->auth_data['token'],
'Content-Type' => 'application/json'
])->post($url);
However, when using the above HTTP in tinker, it works, inside my Laravel job I get a 500
error from the server. I have reached out to the server devs, pending response