0

大家好,我只是想问一下,如何在 PHP 中编写以下代码

<input type="text" name="SteamID64"> 

当该人进入并单击按钮时,它应该在下面填写该值

    <?php
$xml=simplexml_load_file("http://steamcommunity.com/profiles/<STEAMID64 HERE>?xml=1");

echo $xml->steamID . "<br>";
echo $xml->onlineState . "<br>";
echo $xml->privacyState . "<br>";
echo $xml->avatarFull . "<br>";
echo $xml->body;
?>

对不起,如果我做错了这个问题,我是新来的

4

2 回答 2

1

用于$_POST获取 id:

$format = "http://steamcommunity.com/profiles/%s?xml=1";
$url = sprintf($format, $_POST["SteamID64"]);
$xml=simplexml_load_file($url);

我假设您已正确设置表单,例如:

<form action="TheTarget.php" method="post">
    <input type="text" name="SteamID64" /> 
    <input type='submit' value='submit' />
</form>
于 2013-07-26T18:22:37.100 回答
0
if (isset($_POST['SteamID64'])) {
 $id  = $_POST['SteamID64'];
 $xml = simplexml_load_file("http://steamcommunity.com/profiles/{$id}?xml=1");
}
于 2013-07-26T18:24:41.737 回答