I have a function in controller and I want to call an HTTP request passing url like GET request in AJAX but I couldn't figure how do I use it using php I tried this
public function sendAPIRequest()
{
$url = "https://myapi.com?apikey=".$api."&message=".$message."&receiver=".$receiver;
//This is what I tried
file_get_contents($url);
//But it didn't work
}