Minecraft のユーザー名が支払われているかどうかを確認しようとしています。
URL の末尾にユーザー名を入力すると、true または false が返されます。
$input = 'Notch';
function checkPlayer($player) {
$mcURL = 'http://www.minecraft.net/haspaid.jsp?user=';
$auth = file_get_contents($mcURL . $player);
if ($auth === true) {
echo $player. ' is valid';
} else {
echo $player. ' is not valid';
}
}
checkPlayer($input);
しかし、それはtrueを返しません。ページhttp://www.minecraft.net/haspaid.jsp?user=Notchに移動すると、true が返されます。どうすれば正しくチェックできますか?file_get_contents
この問題に使用する関数は間違っていると思います。よくわかりませんが。