From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Downloading web data from a CSV file into your VI

I am trying to learn how to download data from the web, but I'm afraid I haven't gotten very far. As an example I would like to download data from a CSV file. I am trying to use "URL Get Document.vi" because it seemed like the most straightforward option.

 

http_get_document.png

 

But I get the following error message: (Untitled 3.vi is the name of my VI)

 


Error 1 occurred at TCP Read in NI_InternetTK_Common_VIs.lvlib:TCP Buffered Read.vi:3->NI_InternetTK_Core_VIs.lvlib:URL Get HTTP Document.vi:2->NI_InternetTK_Core_VIs.lvlib:URL Get Document.vi->Untitled 3


Possible reason(s):

LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.

 


 

 

I tried using "http://finance.yahoo.com/d/quotes.csv" and even "finance.yahoo.com/d/quotes.csv" but it still returns the same error.

 

What gives?

 

LV 2009

Win XP

 

0 Kudos
Message 1 of 6
(3,790 Views)

I ran this function using just "http://finance.yahoo.com/d/quotes.csv" and got a different error:

 

getHTTP.png

Hmm, if the connection was really closed on the other end there might be something about the way that yahoo serves up that csv file.  Maybe try to find another csv file on another site and see if it gives you the same error when trying to download it.

0 Kudos
Message 2 of 6
(3,752 Views)

I am getting the same error for very small webpages, less than 1024 bytes.

If you stick the  'No EOC Error' vi in the code of the 'URL Get HTTP Document' vi like this, it will work just fine.

The code reads a header first, and it assumes that the document is always larger than 1024 bytes, as it reads a header of 1024 files and creates a error 66 if the document is less.

 

-Nils

 

fix for short URL files.JPG

Message 3 of 6
(3,740 Views)

Hi,

 

I also get the error 66 when trying to download an xml-file from 127.0.0.1 . Only if the file is very small it works. What can be done about this error ? 

0 Kudos
Message 4 of 6
(3,668 Views)

Hey tibet,

 

You said you could only get very small files to work when you are trying to download an xml-file from the local host. Do you know the maximum size that you can download without getting the error ( for example 1024 bytes)?  Can you post a code snippet of what you are trying to do when you are downloading the xml-file so I have an idea of what you are doing?

 

Also, have you looked at TCP read function in the TCP Buffered Read.vi which is a subVI of the URL Get HTTP Document.vi  to mess around with the number of bytes getting read?

 

zone.ni.com/reference/en-XX/help/371361H-01/lvcomm/tcp_read/

 

Regards,

 

 

Tommy G.
Product Manager - Search
0 Kudos
Message 5 of 6
(3,638 Views)

I've found an old post where someone suggests using datasocket:

 

http://forums.ni.com/t5/LabVIEW/how-do-one-download-the-csv-file-that-Yahoo-generates-when/m-p/19989...

 

 

Anyhow it'll we very interesting to find out why we got the error....

 

Marco

0 Kudos
Message 6 of 6
(3,626 Views)