In the context of PHP, what methods can be used to view and analyze the response from an API call?

When making API calls in PHP, it is important to view and analyze the response to ensure that the call was successful and to extract any relevant data. One common method to view the response is by using the `file_get_contents()` function to retrieve the API response as a string, and then using `json_decode()` to convert the JSON response into a PHP object or array for further analysis.

// Make API call
$url = 'https://api.example.com/data';
$response = file_get_contents($url);

// Check if API call was successful
if ($response === false) {
    die('Error: Unable to retrieve API response');
}

// Decode JSON response
$data = json_decode($response, true);

// Analyze the response data
var_dump($data);