Download File Problem?

Just starting out? Need help? Post your questions and find answers here.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Download File Problem?

Post by collectordave »

using this URL

http://stampcollector.epizy.com/DBVersion.txt

or stampcollector.epizy.com/DBVersion.txt

In firefox the file downloads and displays no bother.

The file is simple text "Database - 3"

Using this code

Code: Select all

  InitNetwork()

  Filename$ = "C:\Temp\DBVersion.txt"
  If ReceiveHTTPFile("http://stampcollector.epizy.com/DBVersion.txt", Filename$)
    Debug "Success"
  Else
    Debug "Failed"
  EndIf
The programme reports success but the downloaded file contains

"<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("72a6de536a1c2b05000c649ed3e4da8c");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://stampcollector.epizy.com/DBVersi ... cript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>"

Anyone any ideas??

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Download File Problem?

Post by collectordave »

Just tried it with the webgadget and it works and displays ok!

Code: Select all

Global Window_0

Global WebView_0



  Window_0 = OpenWindow(#PB_Any,0, 0, 600, 400, "", #PB_Window_SystemMenu)
  WebView_0 = WebGadget(#PB_Any, 80, 10, 500, 370, "stampcollector.epizy.com/DBVersion.txt")
  
  
  Repeat
      
      Event = WaitWindowEvent()
      Select Event
        Case #PB_Event_CloseWindow
          End
  
      Case #PB_Event_Menu
        Select EventMenu()
        EndSelect
  
      Case #PB_Event_Gadget
        Select EventGadget()
        EndSelect
    EndSelect
    
    ForEver
Is it possible to download a file with the webgadget??
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: Download File Problem?

Post by wombats »

Hmm. I tried your code with another text file and it worked. Could it be a setting on your web server? I'm assuming the WebGadget can display it because the server is returning HTML and it's interpreting and displaying that.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Download File Problem?

Post by collectordave »

Tried same text file on another server as well and works fine.

With what it returns I am assuming it has some form of security on the server so my search for free web hosting goes on.

Thanks
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Download File Problem?

Post by Marc56us »

ReceiveHTTPFile is a file downloader only so does not execute the content in source (vbscript/ javascript)

WebGaget as for him is a browser so execute script inside.

:wink:
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Download File Problem?

Post by collectordave »

Thanks all,

Getting the idea.

Recieve file makes a mess of zips as well. However the webgadget downloads all ok except does not save .txt or pdf but displays them not a great problem will rename to something unknown and see how that works.

Leaves just one more thing can the download from the webgadet be directed to a specific folder i.e. changes users download folder until download done?
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: Download File Problem?

Post by wombats »

It seems InfinityFree have a feature that is designed to cause this behaviour: https://infinityfree.net/support/javasc ... droid-app/.

You can usually find cheap hosting on http://www.webhostingtalk.com/. Getting your own would be best if your software needs to reliably download something it relies on.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Download File Problem?

Post by collectordave »

Using InfinityFree and great as a webpage server found mediafire to host all the files all works fine then.

thanks to all.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply