Is It Possible to Retrieve Data From An Url ?

Monkey Forums/Monkey Beginners/Is It Possible to Retrieve Data From An Url ?

FaSaSoftware(Posted 2016) [#1]
Dear friends,

Well, i need please an help with fresh code for a project of mine...

I need to retrieve every second the value of some money pairs...but for example is ok for one...

1) first of all i have registered me to true.fx ...

2) this is a demo url without my registration of course but working... :
http://webrates.truefx.com/rates/connect.html?f=html&c=AUD/USD

this give this result: AUD/USD 1462567500019 0.73667 0.73681 0.73373 0.74784 0.74643

I need to retrieve this value AUD/USD 0.73667 the first value to
work and put it into a variable and update every second

So i don't know if i must get my url and retrieve that data?
..any idea?? thanks a lot in advance
Lestroso


therevills(Posted 2016) [#2]
It'll be something like this:


Note that if using HTML5 target you might get some cross site scripting issues, have a read up on Access-Control-Allow-Origin.


FaSaSoftware(Posted 2016) [#3]
Dear therevills,

You save my life!!!! Thank a lot , very much!!...There are no words to thank you!!!!

Is there a manner to cut the returned string...like left string operation on the "text" variable??...any example?? thank a lot again...

Best regards,

Lestroso


Pharmhaus(Posted 2016) [#4]
if your data contains spaces you can just split it up:
		Local str:string[] = "A B C D".Split(" ")
		For Local i:String = EachIn str
			Print i
		Next

Here is thread about strings and slices *click*.


FaSaSoftware(Posted 2016) [#5]
Thanks a lot Pharmhaus,

i have made this solution.... this work fine for me...to cut text variables....


Method OnHttpRequestComplete:Void(req:HttpRequest)
		If req = request
			status = req.Status()
			text = req.ResponseText()
			text=text[9..]
			text=text[..9]
			text=text[..5]
			End


Thanks lestroso