Hi,
sowas in der Art:
PHP-Code:
<html>
<body>
<form method = "post" action = "get.php3">
<table align = "center">
<tr><td>
host</td><td><input type = "text" name = "host" value ="<?php echo $host; ?>"><br>
</td></tr>
<tr><td>
file</td><td><input type = "text" name = "file" value ="<?php echo $file; ?>"><br>
</td></tr>
<tr><td>
user</td><td><input type = "text" name = "user" value ="<?php echo $user; ?>"><br>
</td></tr>
<tr><td>
pass</td><td><input type = "text" name = "pass" value ="<?php echo $pass; ?>"><br>
</td></tr>
<tr><td>
<input type = "submit" name = "submit" value ="submit"><br>
</td></tr>
</table>
</form>
<?php
if ($submit) {
$port = 80; //http port
$timeout = 30; //seconds ??
$sock = fsockopen($host, $port, $errno, $errstr);//, $timeout);
if ($sock) {
if ($user) {
$authstr = "Authorization: Basic ". base64_encode($user. ":". $pass). "\r\n";
} else {
$authstr = "";
}
$getstr = "GET /". $file. " HTTP/1.0\r\n".
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\n".
"ACCEPT_CHARSET: iso-8859-1,*,utf-8\r\n".
"ACCEPT_ENCODING: gzip\r\n".
"ACCEPT_LANGUAGE: en\r\n".
"CONNECTION: Keep-Alive\r\n".
"HOST: [url]www.xyz.de\r\n[/url]".
"PRAGMA: no-cache \r\n".
"USER_AGENT: Mozilla/4.51 [en] (maybe)"./* (X11; I; Linux 2.2.5 i486)*/"\r\n".
$authstr.
"\r\n";
fputs($sock, $getstr);
$return = "";
while (!feof($sock)) {
$return .= fgets ($sock, 1024);
}
fclose($sock);
echo "received file starts here:<br>\n";
echo $return;
} else {
echo "Fehlernummer: ". $errno."<br>Fehlertext: ".$errstr."<br>\n";
}
}
?>
</body>
</html>
Hoffe es hilft,
Lesezeichen