Logo Peer-to-peer VPN

PHP Service

On this page I will present a small (75 lines) PHP service dedicated to storing and querying beacons by VpnCloud.

The PHP script is very simple and has the following requirements:

Setup

The setup of this service is pretty simple: download the PHP script and put it on a server that meets the requirements. Make sure that the database is writable by the webserver user. Thats it.

If you want, you can protect the database file using a .htaccess file, so that it cannot be downloaded as a whole. But since the information is not secret and encrypted anyhow, this is not necessary.

If you do not have a public server or do not want to host this service, you can use the service running on this server at:

https://vpncloud.ddswd.de/beacondb.php

On each node wget is required to store and query beacons.

Storing Beacons

The PHP script allows storing beacons via HTTP POST requests:

beacon:
  store: '|wget -O - --post-data "beacon=$beacon" http://your.server.com/beacondb.php'

Loading Beacons

Loading beacons can be done very efficiently, as the service offers filtering via prefix:

beacon:
  load: '|wget -O - http://your.server.com/beacondb.php?net=$begin'