![]() |
![]() |
10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
#-#############################################
use strict;
use warnings;
use IO::Socket qw(:DEFAULT :crlf);
#-#############################################
$/ = CRLF.CRLF;
my ($data, $host, $path, $socket, $header);
my $url = 'http://IrgendWo';
#-#############################################
($host, $path) = $url =~ m!^http://([^/]+)(/[^\#]*)!
or die "URL nicht gültig";
$socket = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => 80,
Proto => 'tcp',
Type => SOCK_STREAM
) or die("keine Verbindung zu $host <br>$@<br>");
print $socket qq|GET $path HTTP/1.0|.CRLF.CRLF;
$header = <$socket>;
$header =~ s/$CRLF/\n/g;
#print $header;
print $data while read($socket, $data, 1024) > 0;
close $socket;
#-#############################################
exit;
Quotedu musst dem server mitteilen, welchen host du anfragen möchtest, damit er das bestimmen kann
QuoteThe absoluteURI form is only allowed when the request is being made to a proxy. The proxy is requested to forward the request and return the response. If the request is GET or HEAD and a prior response is cached, the proxy may use the cached message if it passes any restrictions in the Expires header field. Note that the proxy may forward the request on to another proxy or directly to the server specified by the absoluteURI. In order to avoid request loops, a proxy must be able to recognize all of its server names, including any aliases, local variations, and the numeric IP address. An example Request-Line would be:
GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.0
The most common form of Request-URI is that used to identify a resource on an origin server or gateway. In this case, only the absolute path of the URI is transmitted (see Section 3.2.1, abs_path). For example, a client wishing to retrieve the resource above directly from the origin server would create a TCP connection to port 80 of the host "www.w3.org" and send the line:
GET /pub/WWW/TheProject.html HTTP/1.0
followed by the remainder of the Full-Request. Note that the absolute path cannot be empty; if none is present in the original URI, it must be given as "/" (the server root).
print $socket "GET $path HTTP/1.0" . CRLF . "Host: $host" . CRLF . CRLF;
![]() |
![]() |
10 Einträge, 1 Seite |