Jump to content

Downloading a file referenced in a web page


Recommended Posts

This is really more of an internet question than a LV question, but a similar situation was discussed before so I hope I'm safe. I'd like to download a file that's referenced in a web page. For example the web page is http://bayradio.com/kgo_archives/test.php?d=4. On that web page there are several links to files that can be downloaded. If I mouse over the file I want it shows a link like http://bayradio.com/kgo_archives/41400.mp3. I've tried the VIs found elsewhere on LAVA and the "save_file_from_web" VI at the NI site and it doesn't work to download directly from that URL. The question is why? If I type that URL into Firefox it'll download it and start playing the file. Actually the real question is how do you download from a link on a web page?

George

Link to comment

QUOTE(george seifert @ Feb 12 2008, 08:45 PM)

This is really more of an internet question than a LV question, but a similar situation was discussed before so I hope I'm safe. I'd like to download a file that's referenced in a web page. For example the web page is http://bayradio.com/kgo_archives/test.php?d=4. On that web page there are several links to files that can be downloaded. If I mouse over the file I want it shows a link like http://bayradio.com/kgo_archives/41400.mp3. I've tried the VIs found elsewhere on LAVA and the "save_file_from_web" VI at the NI site and it doesn't work to download directly from that URL. The question is why? If I type that URL into Firefox it'll download it and start playing the file. Actually the real question is how do you download from a link on a web page?

George

I found myself with a problem a lot like yours a couple of weeks ago, and i ended up downloading a small command line program called curl to do the job. Just throw an url at this baby using the System Exec.vi and it will download avi, wmv, mpg, mp3 and all the media files you would ever want, directly to your hard drive! :0)

Also .. if you have some skillz you can even use this small tool to sniff the http replys from the webserver and change the url dynamically if you receive a http location redirection.

Otherwise .. you can download smaller media files using datasocket read .. eg. pngs, jpegs and gifs by appending [txt] to the end of the url you pass to the function. This way you get the raw file contents back, and you can freely save this data to a file of your own liking.

Hope this helps you on your way .. :0)

If i have misunderstood your question, i'm sorry..heh

/Stinus

Link to comment

QUOTE(george seifert @ Feb 12 2008, 01:41 PM)

I second the http://curl.haxx.se/' target="_blank">cURL recommendation. It's really great. It can handle logins/forms/cookies/redirects/etc. It's a little tricky to get used to unless you're accustomed to lots of Unix-style command line switches (even on Windows), but it's a great Swiss Army knife tool.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.