Feb 141013
 

Note: This post is only valid for Argentina.

Sometimes it is necessary to know the price of the dollar (Budgets, service charges or goods abroad), which is why we decided to launch in GEEKLAB a Web service that can be useful to webmasters and programmers.

The service consists of an interface json and an iframe to be placed somewhere on your website.

First we see the iframe, for that you must enter the following code into your site.

<iframe src="http://ws.geeklab.com.ar/dolar/dolar-iframe.php" height="60" width="160" frameborder="0" scrolling="no"></iframe>

Which would look as follows


And now he json interface (we will see an example in PHP)

<?php
$data_in = "http://ws.geeklab.com.ar/dolar/get-dolar-json.php";
$data_json = @file_get_contents($data_in);
if(strlen($data_json)>0)
{
  $data_out = json_decode($data_json,true);

  if(is_array($data_out))
  {
    if(isset($data_out['libre'])) print "Libre: ".$data_out['libre']."<br>\n";
    if(isset($data_out['blue'])) print "Blue: ".$data_out['blue']."<br>\n";
  }
}
?>

As we see once we make the data json_decode get an array with two pairs of key => value, key ‘free’ gives us the official rate of the dollar and the key ‘blue’ quote gives us the parallel dollar.

Hope this article is helpful to webmasters and programmers.

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.