Forum > Networking and Web Programming
[SOLVED] Help for downloand file
magleft:
Hello. I want to downloand file from following url
https://1click.minagric.gr/oneClickUI/frmFytoPro.zul?lang=en
I want to downloand file with Lazarus with synapse but can' t find url of file.
Can someone help me?
Thanks in advance.
bobby100:
The download link is in an invisible iframe, and the iframe opens by the JavaScript after you click on "here".
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---<iframe src="/oneClickUI/zkau/view/z_det/dwnmed-0/ifc1/dbSYSPEST.zip" id="zk_download" name="zk_download" style="visibility:hidden;width:0;height:0;border:0" frameborder="0"></iframe>I do not know if the link is persistent, or it is generated every time you click on "here".
TRon:
Seems like the link is not persistent %)
magleft:
Thanks for reply.
Every time who pres <here> button start downloand a file. If pres right button on downloand file i copy
a link of file but is different every time. For example following links.
https://1click.minagric.gr/oneClickUI/zkau/view/z_i2e/dwnmed-0/g3k1/dbSYSPEST.zip
https://1click.minagric.gr/oneClickUI/zkau/view/z_i2e/dwnmed-1/tnp/dbSYSPEST.zip
I think that means generete link every time when press "here" button.
So how could the download of the file be done automatically through lazarus?
BobDog:
I can get a file via windows bitsadmin, but nothing to do with Lazarus, only freepascal.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- usessysutils; function shell(s:pchar):integer ; cdecl external 'msvcrt.dll' name 'system'; function filelength(filename:ansistring):longword;Var F : File of byte;var L:longword;beginAssign (F,filename); Reset (F); L:=FileSize(F); Close (F); exit(L);end; procedure loadfile(var content: ansistring;filename:ansistring); Var Fin : File; Var x:int32; begin x:=filelength(filename); setlength(content,x); Assign (Fin,filename); Reset (Fin,x); BlockRead (Fin,content[1],1); close(fin);end; procedure download(site:ansiString;newfile:ansistring);varf,content:ansistring;begincontent:='';if fileexists(newfile) then deletefile(newfile); If (pos(' ',site) <>0) Then site:=Chr(34)+site+Chr(34); f:='type nul > ' +GetCurrentDir +'\'+newfile; // create empty file shell (pchar(f)); shell('bitsadmin /reset'); shell ('bitsadmin /create mydownload'); f:='bitsadmin /transfer mydownload /download /priority normal /DYNAMIC ' + site +' '+ Chr(34) + GetCurrentDir +'\'+ newfile +Chr(34); Shell(pchar(f)); shell ('bitsadmin /complete mydownload'); if (filelength(newfile)<>0) then loadfile(content,newfile) else exit; f:=Chr(34) +GetCurrentDir + '\'+newfile + Chr(34); If (Length(content)>4) Then Shell (pchar(f));End; varsite:ansistring='https://1click.minagric.gr/oneClickUI/frmFytoPro.zul?lang=en'; beginshell('Title Please wait a few seconds until Job completed');download(site,'New.file');writeln('Press return to finish . . .');readln;end.
Navigation
[0] Message Index
[#] Next page