PHP
To make API requests using PHP, you can use the built-in cURL functions or a library like GuzzleHttp. Here's an example using GuzzleHttp:
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->get('https://api.tinyapi.co/your-api-endpoint', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY'
]
]);
if ($response->getStatusCode() == 200) {
echo json_encode(json_decode((string) $response->getBody()));
} else {
echo "Error: {$response->getStatusCode()}";
}