How do I use PHP to communicate with my Remote IO Module?


Download (6.0 kB)

PHP is a server side and scripting language used primarily on the web. PHP is used in approximately 80% of all websites (for example, & Brainboxes has provided a Brainboxes.IO PHP API to allow easy integration of Brainboxes Ethernet Remote IO Modules (ED-XXX) into your PHP code.


  • Windows/Mac/Linux Computer
  • PHP Runtime (PHP 5.3.0 and above)
  • PHP Development Environment
    (e.g. Eclipse, PHP for Visual Studio, IntelliJ, NetBeans or a simple text editor)
  • Brainboxes.IO API for PHP

Code Sample

The following sample code connects to a Brainboxes Ethernet Remote IO Module and sends the ASCII command to get the device name:

<h1>Brainboxes.IO PHP API Example</h1>
    This file is part of the javascript example/library code for communication with
    Brainboxes Ethernet-attached data acquisition and control products, and is
    provided by Brainboxes Limited.  Examples in other programming languages are
    also available.
    Visit to see our range of Brainboxes Ethernet-
    attached data acquisition and control products, and to check for updates to
    this code package.
    This is free and unencumbered software released into the public domain.
use Brainboxes\IO\EDDevice as EDDevice;

$deviceIP = "";
//$01M means get device name
$command = "$01M";
$response = null;
<p>Attempting to connect to Brainboxes ED device at: <?php echo $deviceIP;?></p>

    $device = new EDDevice($deviceIP,$port);
	$response = $device->sendCommand($command);

<p>Message sent: <?php echo $command; ?></p>
<p>Response: <?php echo $response; ?></p>


For a full list of ASCII protocol commands which can be sent to the device see:
Brainboxes Remote IO ASCII protocol reference