Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Colaboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 29-09-2014
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
jhonalone,

Cita:
Empezado por jhonalone
...Estoy intentando ver la fecha de modificación de un fichero que está en mi página de internet...


Revisa este código:
Código Delphi [-]
 unit Unit1;
 
 interface
 
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, StdCtrls, WinInet;
 
 type
   TForm1 = class(TForm)
     Button1: TButton;
     procedure Button1Click(Sender: TObject);
   private
     { Private declarations }
   public
     { Public declarations }
   end;
 
 var
   Form1: TForm1;
 
 implementation
 
 {$R *.dfm}
 
 // Obtiene la última fecha de modificación de un archivo en internet
 function GetLastModifiedDate(Url : String) : TDateTime;
 var
    hInet : HINTERNET;
    hUrl : HINTERNET;
    LastModifiedDate : SYSTEMTIME;
    SizeDate : DWORD;
    Index : DWORD;
 begin
    try
       hInet := InternetOpen(PChar(Application.Title),INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
       hUrl := InternetOpenURL(hInet,PChar(Url),nil,0,0,0);
       SizeDate := SizeOf(LastModifiedDate);
       Index := 0;
       if HttpQueryInfo(hUrl,
                        HTTP_QUERY_LAST_MODIFIED or HTTP_QUERY_FLAG_SYSTEMTIME,
                        @LastModifiedDate,
                        SizeDate,
                        Index)
       then
          Result := SystemTimeToDateTime(LastModifiedDate)
       else
          Result := 0;
    finally
       InternetCloseHandle(hUrl);
       InternetCloseHandle(hInet);
    end;
 end;
 
 // Muestra la última fecha de modificación de un archivo en internet
 procedure TForm1.Button1Click(Sender: TObject);
 var
    Url : String;
    LastModifiedDate : String;
 begin
    Url := 'http://www.math-magic.com/pdf_files/basic_memorization/prime.pdf';
    LastModifiedDate := FormatDateTime('yyyy/mm/dd hh:mm:ss',GetLastModifiedDate(Url));
    MessageDlg(LastModifiedDate,mtInformation,[mbOK],0);
 end;
 
 end.
El código anterior en Delphi 7 sobre Windows 7 Professional x32, obtiene la fecha de última modificación de un recurso url por medio de las funciones de Windows Internet (WinINet) application programming interface (API) .

Espero sea útil

Nelson.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Extraer la fecha de modificación de un fichero mediante FTP JoysticK Internet 3 23-08-2018 01:30:30
Fecha de modificación de un archivo ftp Vlady Varios 3 09-01-2012 09:20:41
Obtener las fechas de un fichero (creación, modificación y último acceso) Neftali [Germán.Estévez] Trucos 0 12-06-2006 17:48:07
Obtener la fecha de modificación de un archivo Javi2 Varios 2 08-11-2004 09:49:36
Fecha modificacion de un campo de la tabla into_enter Conexión con bases de datos 2 18-06-2003 09:57:19


La franja horaria es GMT +2. Ahora son las 04:24:26.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi