17-03-2014, 11:43 PM
السلام عليكم
برنامج مفتوح المصدر يحتوي على حالة الطقس ووقت الغروب والشروق ...
يمكنكم استخدام الاحداثيات او اسم المدينة لايجاد المعلومات بالاضافة الى مفتاح وللحصول عليه اضغط هنا
مثلا
![[صورة: z5n9.png]](http://img546.imageshack.us/img546/3913/z5n9.png)
لعشرة ايام
![[صورة: z55v.png]](http://img35.imageshack.us/img35/7547/z55v.png)
الكود سورس
برنامج مفتوح المصدر يحتوي على حالة الطقس ووقت الغروب والشروق ...
يمكنكم استخدام الاحداثيات او اسم المدينة لايجاد المعلومات بالاضافة الى مفتاح وللحصول عليه اضغط هنا
مثلا
PHP كود :
q/37.336500,7.183000.json
او
q/Batna.json
![[صورة: z5n9.png]](http://img546.imageshack.us/img546/3913/z5n9.png)
لعشرة ايام
![[صورة: z55v.png]](http://img35.imageshack.us/img35/7547/z55v.png)
الكود سورس
PHP كود :
uses
IdHTTP,GIFImage,superobject,
PHP كود :
procedure TForm1.loadgif(http: string;img:TImage);
var ms : TMemoryStream;
gif: TGIFImage;
begin
img.Picture:=nil;
gif := TGIFImage.Create;
ms := TMemoryStream.Create;
try
try
idhttp1.Get(http,ms);
///MS.Seek(0,soFromBeginning);
ms.Position:=0;
gif.LoadFromStream(ms);
img.Picture.Assign(gif);
except
end;
finally
gif.Free;
ms.Free;
end;
end;
procedure TForm1.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
AWorkCount: Int64);
begin
Application.ProcessMessages;
sgauge1.Progress:=AWorkCount;
end;
procedure TForm1.IdHTTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
AWorkCountMax: Int64);
begin
sgauge1.MaxValue:=AWorkCountMax;
end;
procedure TForm1.IdHTTP1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
begin
sgauge1.Progress:=0;
end;
procedure TForm1.FormShow(Sender: TObject);
var conditions,astronomy:string;
begin
try
conditions:=idhttp1.Get('http://api.wunderground.com/api/a08dd34c67819ee0/conditions/q/Batna.json');//&ip='+edt1.Text);
astronomy:= idhttp1.Get('http://api.wunderground.com/api/a08dd34c67819ee0/astronomy/q/Batna.json');
except
sLabelFX1.Caption:=('Temperature : 0 C');
sLabelFX3.Caption:=('Station : Not Connected');
end;
if Length(conditions)=0 then Exit;
sLabelFX1.Caption:=('Temperature : '+so(conditions)['current_observation']['temperature_string'].AsString) ;
sLabelFX2.Caption:=('Location : '+so(conditions)['current_observation']['display_location']['full'].AsString) ;
sLabelFX3.Caption:=('Station : '+so(conditions)['current_observation']['icon'].AsString) ;
sLabelFX7.Caption:=(so(conditions)['current_observation']['temp_c'].AsString+' C') ;
sLabelFX4.Caption:=('Weather : '+so(conditions)['current_observation']['weather'].AsString) ;
sLabelFX5.Caption:=('Relative Humidity : '+so(conditions)['current_observation']['relative_humidity'].AsString) ;
sLabelFX6.Caption:='Elevation : '+Format('%.6s',[(so(conditions)['current_observation']['display_location']['elevation'].AsString)]) ;
loadgif(so(conditions)['current_observation']['icon_url'].AsString,img1) ;
if Length(astronomy)=0 then Exit;
sLabelFX8.Caption:=(so(astronomy)['sun_phase']['sunrise']['hour'].AsString+':'+
so(astronomy)['sun_phase']['sunrise']['minute'].AsString) ;
sLabelFX9.Caption:=(so(astronomy)['sun_phase']['sunset']['hour'].AsString+':'+
so(astronomy)['sun_phase']['sunset']['minute'].AsString) ;
end;
procedure TForm1.sSpeedButton1Click(Sender: TObject);
var forecast10day:string;
i:Byte;
begin
try
forecast10day:=idhttp1.Get('http://api.wunderground.com/api/a08dd34c67819ee0/forecast10day/q/Batna.json');
if Length(forecast10day)=0 then Exit;
for i:=0 to 19 do
with form2.sListView1.Items.Add do begin
Caption:=so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].title'].AsString ;
SubItems.Add(so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].fcttext'].AsString) ;
SubItems.Add(so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].icon'].AsString) ;
SubItems.Add(so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].fcttext_metric'].AsString) ;
end;
except
end;
form2.show;
end;

