Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to retrieve data from a website but I keep getting errors

Solved!
Go to solution

Hi, So in my project im supposed to retrieve the oil prices and convert it from USD to the local currency,
I have this code but It just won't work and i get errors "Error 1181 occurred at DataSocket Read" and "Error 1 occurred at Scan From String (arg 1)".
I'm totally lost here can someone help?

codeQ.PNG

0 Kudos
Message 1 of 4
(2,459 Views)
Solution
Accepted by topic author ham19949

@ham19949 wrote:

I have this code ...


(No, that's just a picture that we cannot debug)

 

Datasocket tools don't support https. Use http get instead. Seems to work just fine with your URLs.

 

gethttps.png

0 Kudos
Message 2 of 4
(2,406 Views)

Apologies I'm new to this, but could you please tell me how to obtain specific data from the page using "HTTP get"? For example I want to only get the price from this page (https://www.investing.com/commodities/crude-oil)..

 

Thanks for your reply.

 

Edit: Never mind I got it, Thanks again!

0 Kudos
Message 3 of 4
(2,394 Views)

Unfortunately, this site does not offer an API to get short answers with a tailored URL. Seems like you need to keep parsing the gigantic string as you already did. (and if they ever change the page code in the future, you would need to adjust too).

I am sure the same information is available on other sites that offer a better interface, but I can't help you with that.

0 Kudos
Message 4 of 4
(2,382 Views)