Link to home
Start Free TrialLog in
Avatar of nikola_mk
nikola_mk

asked on

How can I find mirror URL for my file on internet

How can I find component or source code for delphi, that for given name of the file on the internet finds mirror URL of same file.
Thank you.

-Nikola
Avatar of DavidBirch2dotCom
DavidBirch2dotCom

I doubt there is a component speificaly for that, however there are delphi FTP client components/packages around such as
http://www.marshallsoft.com/fce4d.htm and http://www.sharewareconnection.com/ftp-client-engine-for-delphi.htm 

You could try searching them for the right file name and size. If you want more information about FTP  and finding mirrors I would have a look at some of the links on this page

http://www.filewatcher.com/ftp.html

Hope that helps

David
Avatar of nikola_mk

ASKER

DavidBirch2dotCom  thank you very mach.
But can you post me example for my problem using this component, or who  of these examples can I used.
 -Nikola
There are examples of how to use the component within the download, available here http://www.marshallsoft.com/fce4d.htm They give examples of how to log into anonymous FTP sites and list the files, you could then modify the example to search the list of files for the one you want mirrors for.

As an alternative, if you just want to show users where they can get the download from, then open a web browser and search one of the many mirror sites such as

http://www.filemirrors.com/search.src?type=equals&file=MYfile.zip
http://www.filewatcher.com/?q=MYfile.zip 

If you want an example of this, try sticking this on a button, once you have added ShellAPI to he uses,

Var
        MYfile: string;
        ByteSize: integer;
begin
   MYfile:= 'winzip90.exe'; // File name
   ByteSize:= 2372760; // size of the file in bytes
   ShellExecute(Handle, 'Open',PChar('Iexplore.exe'), PChar('www.filemirrors.com/search.src?file='+MYfile+'&size='+inttostr(ByteSize)) , nil, SW_SHOW);

If you don’t use Internet Explorer then replace it with the name of exe you do use, although 90% of the internet use Iexplore, If you don’t want to use www.filemirrors.com then you will need to get an example search URL from that site and replace the file name where it occurs in the URL

Hope this helps

David
If you want to get the size of the file in bytes then try this function

function GetHugeFileSize(const Filename: TFileName): Int64;
var
  SearchRec: TSearchRec;
begin
  if FindFirst(Filename, faAnyFile, SearchRec) = 0 then begin
    Result := (Int64(SearchRec.FindData.nFileSizeHigh) shl 32)
               or SearchRec.FindData.nFileSizeLow;
    FindClose(SearchRec);
  end else
    Result := 0;
end;

David
DavidBirch2dotCom  thank you, but if you know  please post me example for my probem using this components, or how can I read result (URLs) form http://www.filemirrors.com using delphi.

 -Nikola
If you want to read the results from searching the sites then you could try using a hidden TwebBrowser and then getting the source from that, I think you would need to download a custom component to be able to save the source of the web page as the Delphi one doesnt have one, there are several of these components on the net for download.  

Once you have the source then you would have to scan though it and find the relivant information for each of the mirrors

Hope that helps

David
ASKER CERTIFIED SOLUTION
Avatar of DavidBirch2dotCom
DavidBirch2dotCom

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial