File: examples/websocket-example.php

Recommend this page to a friend!
  Classes of Jacob Davis  >  PHP Forex Quotes  >  examples/websocket-example.php  >  Download  
File: examples/websocket-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
updated REST && Socket
Version Change and Socket Server Updated
Date: 4 months ago
Size: 1,375 bytes



Class file image Download

    * This library is provided without warranty under the MIT license
    * Created by 1Forge <>

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


$client = new ForexDataClient('0JHZqgJf7V3tvd7BA3MGThQB3NqVX7F9');

//Handle incoming price updates from the server
$client->onUpdate(function($s, $data)
$s . ": " . $data["b"] . " " .$data["a"] . " " . $data["p"]."\n";

//Handle non-price update messages

//Connect to the server
//Subscribe to a single currency pair

//Subscribe to an array of currency pairs

//Subscribe to all currency pairs

//Unsubscribe from a single currency pair

//Unsubscribe from an array of currency pairs

//Unsubscribe from all currency pairs

For more information send a message to info at phpclasses dot org.