For some reason, I can't use CURL to send post requests in homestead. It just returns null and here is my code.
Additional, headers are not being set, even if it's application/json it returns HTML/charset.
$ch = curl_init(env('app_url') . 'applications/' . $position->ats_reference . '/import'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'token' => $user->token, 'data' => [$data] ])); curl_exec($ch); $info = curl_getinfo($ch); dd($info); curl_close($ch);
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.