PHP Classes

File: examples/REST-example.php

Recommend this page to a friend!
  Classes of Jacob Davis   PHP Forex Quotes   examples/REST-example.php   Download  
File: examples/REST-example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Forex Quotes
Get foreign exchange rates quotes for currencies
Author: By
Last change: V6.0.0 fix
Version Change and Socket Server Updated
Date: 3 years ago
Size: 758 bytes
 

Contents

Class file image Download
<?php

   
/*
    * This library is provided without warranty under the MIT license
    * Created by 1Forge <contact@1forge.com>
    */

   
require_once __DIR__ . './vendor/autoload.php';

    use
OneForge\ForexQuotes\ForexDataClient;

   
$client = new ForexDataClient('YOUR_API_KEY');
   
$quotes = $client->getQuotes(['AUD/USD',
                                         
'GBP/JPY']);
   
$symbols = $client->getSymbols();
   
$conversion = $client->convert('EUR', 'USD', 100);
   
$quota = $client->quota();
   
$market_is_open = $client->marketIsOpen();

   
print_r($quotes);
   
print_r($symbols);
   
print_r($conversion);
   
print_r($quota);

    if (
$market_is_open)
    {
        echo
'Market is open!';
    }