We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Dear Friends,
I need to get data from this url "http://webrates.truefx.com/rates/connect.html?f=html" and put it into a variable....or better i need to get data of the money pairs from each moneypair... For example i need to retrieve the numbers the second piece and third piece of numbers, like aud/usd or the other money pair...to work with that.... I thank you a lot in advance..
Lestroso :\">
Answers
Seems like that URL also accepts
?f=csv
besides?f=html
. Maybe other types as well.It means you can use loadTable() or loadStrings() + split() + trim() in order to retrieve those "rates":
Dear GoToLoop....I thank you so Much!!!!! now i will look yours links....but....can you show me an example...by you if you can??? thank a lot again...best regards, lestroso
I have tryed this... but nothing works here....can some body help me please??? i would like to work with P5 code...and not Processing....thanks lestroso :\">
Dear Gotoloop..... i'm sorry but i tryed your software.... but don't work either in processing3, either in P5....but have i miss something??? thanks again Lestroso :\">
can somebody help me with an example working for P5 please??? Thanks a lot in advance....Lestroso X_X
https://forum.Processing.org/two/discussion/16186/how-to-get-data-from-an-url
duplicate deleted.
please don't start duplicate threads.
I'm sorry about that..... but can somebody help me?? the last example don't work for me....I need to retrieve data with a little script...because i'm new and i don't know how to start with p5....
the p5.js loadStrings() example looks pretty clear
https://p5js.org/reference/#/p5/loadStrings
but i can't get that to work with the url you supply, which might be a cross-site scripting problem.
Thanks a lot for your help... i'll try to understand that instruction....thanks again lestroso >:D<
var result; function preload() { result = loadStrings(' http://WebRates.TrueFX.com/rates/connect.html?f=html '); }
function setup() { background(200); var ind = floor(random(result.length)); text(result[ind], 10, 10, 80, 80); }
I have tryed this demo in P5....but nothing works here....but if you goto the this web address go fine... you see the data change....
But how i can work with it??? i thank you in advance...Lestroso
there are rules about websites reading data from other websites. they may block you based on user-agent string or it could be your browser disallowing 3rd party access.
(the processing example, not the p5.js example, works fine fwiw)
many thanks koogs....i must find another site data forex feeds....to work with....lestroso :\">
@fasasoftware: predictably this is a cross domain issue. It doesn't look like the WebRates site has explicitly blocked script access to their data; just that they haven't made it straightforward by enabling CORS. You should double-check their terms and conditions before using this; but in principle you can use a service like crossorigin.me to get around the issue:
I'm amused by the size of the small print on their about us page :D
Dear blindfish....thank you thery much for your answer...but i tryed your code...but don't work either in P5, either in processing3....i think to move to coding with visual studio 2015 community....best regards...lestroso :D
I'm pretty sure I've run my sketch many times before publishing it here for ya! [-(
Moreover, it doesn't seem you had been paying much attention at all.
Just 1 example to illustrate it: I've tipped ya about using
?f=csv
in place of?f=html
.However, you've kept relying on
?f=html
in your next examples! 3:-ORegardless, I've decided to convert the "Java Mode" version to "p5.js".
And to further shield me & prove that it indeed works, I've hosted it here too: :(|)
http://p5ide.HerokuApp.com/editor#?sketch=571b73c18d44c60300fd6496
I saw also visual studio is too complicated....i should learn P5 ....is better...but i need to know that code for a work of mine....very important for me...can somebody help with a code working?? thanks...lestroso
Console output (hit F12 key):
@fasasoftware: Odd as I obviously tested the code before posting it and it worked just fine (in p5.js). You either don't understand what it does; or perhaps tried to run it off the local file system.
From your responses you clearly haven't taken the time to learn the basics of coding in p5js. If you want some code written; but don't want to take the time to learn can I suggest you post a request in events/opportunities and offer suitable remuneration...