Агентство Венгрова


Главная  ::  Архив форума  ::  Просмотр сообщения
смотри, ты сам спросил :) - jsc - 10.12.2007 15:36:43
use HTTP::Request;
use HTTP::Headers;
use LWP::UserAgent;
# use MIME::Base64;

# http://www.igeoe.pt
# change cookie (or these ok?)
# set x0, xmax, y0, ymax, y global shift if required
# enjoy :)

# we're browser :)
$ua = LWP::UserAgent->new;
$ua->agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727');
$hdr = new HTTP::Headers;
$hdr->header(Referer => "http://www.igeoe.pt/igeoearcweb/igeoesig/mapa.asp?cmd=updateOverMap%7C40%7C20&Layeractivo=0&onloadscript=parent.frametoolbar.ZOOMIN.onclick%28%29%3B");
$hdr->header(Host => "www.igeoe.pt");
$hdr->header(Cookie => "ASPSESSIONIDACRQQSCD=COLJMKMCMIJDIOIHGKDIAFGM; ASPSESSIONIDQATACSRQ=JEHFIMEDGLKDGNCAIBFFCGOK");
$hdr->header(Accept => "*/*");
$hdr->header(Accept-Language => "en-us");
$hdr->header(Pragma => "no-cache");
$hdr->header(UA-CPU => "x86");
# 1st point positioning
$req = HTTP::Request->new(GET, 'http://www.igeoe.pt/igeoearcweb/igeoesig/mapa.asp?cmd=Center|-8.88|41.99|19200|', $hdr, );
$res = $ua->request($req);
$req = HTTP::Request->new(GET, 'http://www.igeoe.pt/igeoearcweb/igeoesig/mapa.asp?cmd=refreshDimMap%7C1024%7C1024%7C&Layeractivo=0&onloadscript=parent.frametoolbar.ZOOMIN.onclick%28%29%3B', $hdr, );
$res = $ua->request($req);
# $req = HTTP::Request->new(GET, 'http://www.igeoe.pt/igeoearcweb/igeoesig/mapa.asp?cmd=Zoomescala%7C19200&Layeractivo=0&onloadscript=parent.frametoolbar.ZOOMIN.onclick%28%29%3B', $hdr, );
# $res = $ua->request($req);
# area of download
$nx0=-3;
$nx=-2;
$ny0=54;
$ny=55;
# preliminary shift 20480:25600 - because of shift limitation in 32k
# so currently last part is res_5651.png :) - but of cause you can repeat preliminary shift or choose another start point
$req = HTTP::Request->new(GET, 'http://www.igeoe.pt/igeoearcweb/igeoesig/mapa.asp?cmd=Pan%7C20480%7C25600&Layeractivo=0&onloadscript=parent.frametoolbar.PAN.onclick%28%29%3B&pane.x=0&pane.y=0', $hdr, );
$res = $ua->request($req);
$xsh=1024*$nx0- 20480;
$ysh=1024*$ny0 - 4096 - 25600;

# come on :)
for ($j=$ny0; $j<$ny; $j++) {
for ($i=$nx0; $i<$nx; $i++) {
# request of page with picture address for our shift
$req = HTTP::Request->new(GET, 'http://www.igeoe.pt/igeoearcweb/igeoesig/mapa.asp?cmd=Pan%7C'.$xsh.'%7C'.$ysh.'&Layeractivo=0&onloadscript=parent.frametoolbar.PAN.onclick%28%29%3B&pane.x=0&pane.y=0', $hdr, );
$res = $ua->request($req);

if ($res->is_success) { $a = $res->content;}
open (FO,">>res.htm");
binmode (FO);
print FO $a;
close FO;

$a =~ m/src\=\'output\/continente\_(.+?)\.png/igs;
$pic = $1;

print $pic."-pic ";
# got the picture
$req = HTTP::Request->new(GET, 'http://www.igeoe.pt/igeoearcweb/igeoesig/output/continente_'.$pic.'.png', $hdr, );
$res = $ua->request($req);

if ($res->is_success) { $a = $res->content;}
# save the picture
open (FO,">res_".sprintf("%02i", $j).sprintf("%02i", $i).".png");
binmode (FO);
print FO $a;
close FO;
print "$j$i-png\n";
# shift right
$xsh=1024;
$ysh=0;
}
# shift to start of next line
$xsh=-1024*($nx-$nx0-1);
$ysh=1024;
}

Корневое сообщение
   Wake up Alex, the matrix has you!   -   sharikoff   -   10.12.2007 16:02:55