Skip to content

Instantly share code, notes, and snippets.

Created April 21, 2014 08:24
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
PHP script for sending location APRS message to APRS-IS.
$aprs_callsign = '';
$aprs_passcode = 0;
$aprs_altinfeet = 2080;
// W is the WX icon. See
// Use GPS coordinate format, see
$aprs_coord = '4740.55N/01829.60EW';
$aprs_comment = 'Gerecse WX -';
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket) {
$result = socket_connect($socket, '', 14580);
if ($result) {
// Authenticating
$tosend = "user $aprs_callsign pass $aprs_passcode\n";
socket_write($socket, $tosend, strlen($tosend));
$authstartat = time();
$authenticated = false;
while ($msgin = socket_read($socket, 1000, PHP_NORMAL_READ)) {
if (strpos($msgin, "$aprs_callsign verified") !== FALSE) {
$authenticated = true;
// Timeout handling
if (time()-$authstartat > 5)
if ($authenticated) {
// Sending position
$tosend = "$aprs_callsign>APRS,TCPIP*:@" . date('Hmi') . "z$aprs_coord/A=" .
str_pad($aprs_altinfeet, 6, '0', STR_PAD_LEFT) . " $aprs_comment\n";
socket_write($socket, $tosend, strlen($tosend));
echo $tosend;
Copy link

my location on google maps is 43.671202 / 10.576086

What is the value for $aprs_coord ? i'm not able to do the conversion...

Copy link

Quite strange...the script worked only one tryes did not update data but no error at all...any idea?

Copy link

Please note that date('Hmi') is incorrect. This is hours, month, seconds. It should be date('His') for hours, minutes, seconds.

Copy link

Just used your code (modified for my needs) to send my WX station data to the APRS server. Thanks for posting this for other to use. I'll add a link to my code once it's ready to publish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment