Lankiz, попробуй так
if (isset($_POST['submit'])){
$aid = $_POST['aid'] ? abs(intval($_POST['aid'])) : false;
echo '<p>Ваш ID: '.$aid.'</p>';
$url = file_get_contents('http://сайт.ру/папка-id='.$aid.''.$_SERVER['QUERY_STRING']);
echo $url;
} else {
echo '<form action="index.php" method="post"><b>Введите свой ид:</b><br/>
<input type="text" name="aid" value="" size="6" /><br/>
<input type="submit" name="submit" value="Далее" /></form>';
}