george seifert Posted February 13, 2008 Report Share Posted February 13, 2008 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 Quote Link to comment
Stinus Olsen Posted February 13, 2008 Report Share Posted February 13, 2008 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 Quote Link to comment
george seifert Posted February 13, 2008 Author Report Share Posted February 13, 2008 QUOTE(Zerobite @ Feb 12 2008, 02:05 PM) 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./Stinus The "save_file_from_web.vi" (attached here) from the NI site appends [text] to the URL and uses a datasocket read. It downloads a file without any errors, but the file's empty. There must be something about digging down one level inside a web page that doesn't work. http://lavag.org/old_files/post-2786-1202848801.vi'>Download File:post-2786-1202848801.vi Quote Link to comment
Justin Goeres Posted February 13, 2008 Report Share Posted February 13, 2008 QUOTE(george seifert @ Feb 12 2008, 01:41 PM) The "save_file_from_web.vi" (attached here) from the NI site appends [text] to the URL and uses a datasocket read. It downloads a file without any errors, but the file's empty. There must be something about digging down one level inside a web page that doesn't work. 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. Quote Link to comment
sam Posted February 14, 2008 Report Share Posted February 14, 2008 Give wget (http://en.wikipedia.org/wiki/Wget) a try as well. wget can do recursive, time compare (Changed files) very well. there is wget for windows, also it is included in cygwin package. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.