Just starting out? Need help? Post your questions and find answers here.
Fasasoftware
Posts: 47 Joined: Tue May 26, 2015 11:22 pm
Post
by Fasasoftware » Fri Mar 04, 2016 10:14 pm
Dear Friend,
i need to retrieve these forex data from this url :
http://webrates.truefx.com/rates/connect.html?f=html
and put them into variables like eur/usd, and the other currency from this url... but is good to take the last value
to make more simple the code..
i need to refresh this data every second...
I thank you a lot in adavance,...
As soon as possible i think to buy This wonderful Software -SpiderBasic!!!! I have purchased some years ago the PureBasic Compiler And I'm very happy.
Lestroso
www.fasasoftware.com
Peter
Posts: 1197 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Sun Mar 06, 2016 5:47 pm
Hello Lestroso,
that's not that easy.
You cannot get the data directly from webrates.truefx.com using HTTPRequest() because of the
Same-origin policy .
But you can build a little proxy to get your data. If you are familiar with PHP (and you own a webserver like Apache) you can write something like this:
Code: Select all
<?php
header('Access-Control-Allow-Origin: *');
echo file_get_contents("http://webrates.truefx.com/rates/connect.html?f=html");
?>
and now you are able to access the PHP-Script which serves you the needed data:
Code: Select all
Procedure HttpGetEvent(Success, Result$, UserData)
If Success
Debug Result$
Else
Debug "HTTPRequest(): Error"
EndIf
EndProcedure
URL.s = "http://127.0.0.1/GetRequest.php"
HTTPRequest(#PB_HTTP_Get, URL, "", @HttpGetEvent())
Greetings ... Peter
Fasasoftware
Posts: 47 Joined: Tue May 26, 2015 11:22 pm
Post
by Fasasoftware » Mon Mar 07, 2016 12:16 am
tHANK you Peter...
yes it's a little complicated....but i need to try your code....Thanks again...
Lestroso