In PHP we can call API using cURL or file_get_content.

Using cURL:

//  Initiate curl

$ch = curl_init();

$url = "";

// Set the url

curl_setopt($ch, CURLOPT_URL, $url);

// Will return the response, if false it print the response

curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);

// Execute

$result = curl_exec($ch);

// Will dump a beauty json :3

$result_array = json_decode($result, true);


// Closing


Using file_get_content:

$result = file_get_contents($url);

// Will dump a beauty json :3

var_dump(json_decode($result, true))