我的代码:
private function getServerInfo($servers){
$result = array();
foreach ($servers as $key => $value) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,"https://mcapi.de/api/server-query/".$servers[$key]->ip.":".$servers[$key]->port."");
$result[$key] = json_decode(curl_exec($ch), true);
curl_close($ch);
}
return $result;
}
我做错了什么?我正在尝试检查16个服务器IP,每个服务器需要1秒钟。