|< 1 2 >| | 17 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
#Proxy inaktiv
print $url = "http://www.google.de/search?q=test&ie=UTF-8&oe=UTF-8&hl=de&btnG=Google+Suche";
my $agent = LWP::UserAgent->new();
my $request = HTTP::Request->new('GET', $url);
my $response = $agent->request($request);
if($response -> is_success())
{
print $website = $response->content;
}
else
{
print $website = "Error: ".$response->content;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
format_c@linux:~/perl_samples> perl
use warnings;
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
my $url = "http://www.google.de/search?q=MPlayer&ie=ISO-8859-1&hl=de&meta=";
my ($uri,$param) = split /\?/,$url;
my $ua = LWP::UserAgent->new(agent => 'Mozilla/5.0 (compatible; Konqueror/3; Linux)');
my $request = $ua->request(GET $uri,[split /&|;|=/,$param]);
if ($request->is_success) {
print "OK\n";
}
else {
print "Nicht OK\n";
}
OK
format_c@linux:~/perl_samples>
|< 1 2 >| | 17 Einträge, 2 Seiten |