How to capture data from a gps connected in php

Asked

Viewed 807 times

0

I am trying to develop a tracker system. I have managed to connect the gps with my php server. Only that I am a layman in the subject and I do not know how to capture the msgs that the gps sends me. Someone can help me?

I followed that example and managed to make the gps connect.

Follow the code I used.

require_once('/webserver/production/htdocs/assets/SocketServer.class.php'); // Include
$server = new SocketServer("192.168.1.4",5008); //Criar um servidor de ligação para um determinado endereço IP e ouvir a porta 5008 para conexões
$server->max_clients = 10; // Número de conexoes simultanea permitido
$server->hook("CONNECT","handle_connect"); // Executa a funcao handle_connect cada vez que alguem se conecta
$server->hook("INPUT","handle_input"); // Executar handle_input sempre que é enviado um texto para o servidor
$server->infinite_loop(); // Inicia o servidor

function handle_connect(&$server,&$client,$input){
    $this->db->query("insert into teste (texto) values ($input)"); ////////////////////////////////////////////////////////////////////////////////////////

    SocketServer::socket_write_smart($client->socket,"String? ","");
}

function handle_input(&$server,&$client,$input){// tratar entrada aq
    $trim = trim($input); // removendo espaços no texto de entrada

    //$this->db->query("insert into teste (texto) values ($trim)");///////////////////////////////////////////////////////////////////////////////////////////

    if(strtolower($trim) == "quit"){ // Parar servidor
        SocketServer::socket_write_smart($client->socket,"Ok! Goodbye..."); // Give the user a sad goodbye message, meany!
        $server->disconnect($client->server_clients_index); // Disconecta o cliente
        return;
    }

    $output = strrev($trim); // inverter string
    SocketServer::socket_write_smart($client->socket,$output); // envia o texto invertido
    SocketServer::socket_write_smart($client->socket,"String? ",""); // solicitar outro texto
}
  • Which gps, make, model, type of connection?

  • GPS VDO TRACK EVOLUTION. CONNECTION 3G/4G (GPS) WEBSERVER UBUNTU.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.