Programalama > CGI

Etiketler: asagidaki, kod, ile, sitenizde, hava

Ort. 0
Puan ver:
<br>
#!/usr/bin/perl


use CGI::Carp qw(fatalsToBrowser);
use English;
use CGI;
use integer;
require LWP::UserAgent;
use GD;

$q = new CGI;
$ua = new LWP::UserAgent;
$city =$q->param(city);
$city =~ s/ı/i/g;
$city =~ s/İ/I/g;
$city =~ s/ğ/g/g;
$city =~ s/Ğ/G/g;
$city =~ s/ş/s/g;
$city =~ s/Ş/S/g;
$formil = $city;
$city =~ tr/[a-z]/[A-Z]/;
$begin = "http://www.meteor.gov.tr/pages/";
$data = $begin . $city.'.htm';
$lookup = new HTTP::Request 'GET', "$data";
$response = $ua->request($lookup);
@lines = split (/
/, $response->content);
foreach $item (@lines) {
chomp($item);
$tpl =$tpl.$item;
}
$start = '<!--BURADA BAŞLA-->';
$end = '<TD><div>Rüzgar</TD>';
($part1,$part2) = split(/<!--BURADA BAŞLA-->/,$tpl);
($part3,$part4) = split(/<TD><div>Rüzgar</TD>/,$part2);
($part5,$part6) = split(/<div>Hava Durumu</div>/,$part3);
($part7,$part8) = split(/<br>/,$part6);
($part9,$part10) = split(/</div>/,$part8);
($part11,$part12) = split(/<TD><div>Sıcaklık</div></TD>/,$part8);
($part13,$part14) = split(/<div>/,$part12);
($part15,$part16) = split(/</div>/,$part14);
$part9 =~ s/ı/i/g;
$part9 =~ s/ç/Ç/g;
$part9 =~ s/ğ/g/g;
$part9 =~ s/Ğ/G/g;
$part9 =~ s/ş/s/g;
$part9 =~ s/Ş/S/g;
$part9 =~ tr/[a-z]/[A-Z]/;
print "Content-type: image/png

";
$im = new GD::Image(100,50);
($white,$black,$red,$blue,$yellow) =
(
$im->colorAllocate(255, 255, 255),
$im->colorAllocate(0, 0, 0),
$im->colorAllocate(255, 0, 0),
$im->colorAllocate(0,0,255),
$im->colorAllocate(255,250,205)
);
$im->fill(50,50,$yellow);
$im->rectangle(1,1,99,49,$black);
$im->string(gdSmallFont,5,3,$formil."'da Hava",$black);
$im->string(gdSmallFont,5,17,$part9,$red);
$im->string(gdSmallFont,5,32,"SICAKLIK ".$part15,$blue);

binmode STDOUT;
print $im->png;
exit;
 

 


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2018 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.