从用户名 roblox 获取用户 ID php
get userid from username roblox php
$user = "linkmon99";
$page = file_get_contents("https://api.roblox.com/users/get-by-username?username=$user");
$msg = "> Rolimons : "https://www.rolimons.com/player/$page"
预期的输出应该是:
但它是:
希望有人能帮忙!谢谢!
改为file_get_contents()
function reads a file into a string. You should be using cURL
。
$user = "linkmon99";
$ch = curl_init("https://api.roblox.com/users/get-by-username?username=$user");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$data = json_decode($data);
echo "> Rolimons : https://rolimons.com/player/$data->Id";
// Output: > Rolimons : https://rolimons.com/player/2207291
$user = "linkmon99";
$page = file_get_contents("https://api.roblox.com/users/get-by-username?username=$user");
$msg = "> Rolimons : "https://www.rolimons.com/player/$page"
预期的输出应该是:
但它是:
希望有人能帮忙!谢谢!
改为file_get_contents()
function reads a file into a string. You should be using cURL
。
$user = "linkmon99";
$ch = curl_init("https://api.roblox.com/users/get-by-username?username=$user");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$data = json_decode($data);
echo "> Rolimons : https://rolimons.com/player/$data->Id";
// Output: > Rolimons : https://rolimons.com/player/2207291