34705-vm/api/search.php
Flatlogic Bot 2587a17d37 basic2
2025-10-06 00:19:27 +00:00

21 lines
490 B
PHP

<?php
header('Content-Type: application/json');
$playerName = $_GET['name'] ?? '';
if (empty($playerName)) {
echo json_encode(['player' => []]);
exit;
}
$apiKey = '1'; // Free public API key for testing
$url = 'https://www.thesportsdb.com/api/v1/json/' . $apiKey . '/searchplayers.php?p=' . urlencode($playerName);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
echo $response;