1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/perl -w use strict; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $response = $mech->get('https://www.digikey.com/products/en?vendor=0&keywords=BAS16W'); if ($response->is_success) { print $mech->content; } else { die $response->status_line; }
2018-10-30T11:55:53 kimmyWas meinst du mit "Status Code"?
2018-10-30T12:44:58 kimmyja, ich bekomme den Status 200.
Ich bekomme auch kein komplett HTML, sondern nur JS.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
GET /products/en?vendor=0&keywords=BAS16W HTTP/1.0
Connection: Close
Content-Type: application/x-www-form-urlencoded
Host: www.digikey.com
=================================================================
HTTP/1.1 200 OK
Server: instart/nginx
Date: Tue, 30 Oct 2018 16:05:00 GMT
Content-Type: text/html
Content-Length: 1346
Connection: close
Set-Cookie: i10c.bdddb=c2-8b5a0gSXxIlUDEKPHrh3A;Path=/;domain=.digikey.com
Cache-Control: no-cache, no-store
X-Instart-Request-ID: 13719301888147495117:SEN01-CPVNPPRY11:1540915500:0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/perl -w use strict; use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); $mech->agent_alias('Windows Mozilla'); my $response = $mech->get('https://www.digikey.com/products/en?vendor=0&keywords=BAS16W'); if ($response->is_success) { print $mech->status(); print $mech->content; } else { die $response->status_line; }
$mech->allow( javascript => 1 );
1 2 3 4 5
my $url = 'https://www.digikey.com/products/en?vendor=0&keywords='.$query.''; Log::Log4perl->easy_init($ERROR); # Set priority of root logger to ERROR my $mech = WWW::Mechanize::Chrome-> new(); $mech->get($url); my $html = $mech->content;