Page 1 of 1

How i can retrieve datas from this url?

Posted: Fri Mar 04, 2016 10:14 pm
by Fasasoftware
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. :D

Lestroso :oops:

www.fasasoftware.com

Re: How i can retrieve datas from this url?

Posted: Sun Mar 06, 2016 5:47 pm
by Peter
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

Re: How i can retrieve datas from this url?

Posted: Mon Mar 07, 2016 12:16 am
by Fasasoftware
tHANK you Peter...

yes it's a little complicated....but i need to try your code....Thanks again...

Lestroso :)