curl -X GET --header "Accept: application/json" --header "authorization: <API token>" "https://api.clashofclans.com/v1/locations"
我希望您能将这个cURL命令进行翻译。我尝试查找cURL的教程,但是无法理解它。我目前尝试的代码如下:
$ch = curl_init('https://api.clashofclans.com/v1/clans/%2399VY9JR8');
curl_setopt($ch,CURLOPT_HTTPHEADER,array('authorization: myToken','Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
print_r($result);
curl_close($ch);
尝试从API获取响应并在此处发布和阅读它们。