SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Thu Nov 21, 2024 18:03
SMSTools3 Community » Sample scripts / setups Bottom

GPS Data from SMS to a PHP Script on a Webserver

Login and Post Reply

Page:  1

Author Post
Member
Registered:
Aug 2011
Location: Castrop-Rauxel, Germany
Hi all,

I have a big problem.
I installed SMS Tools3 on my Computer. Everything runs excellently.

But now I would like to do the following.

I´m receiving the following SMS from my GPS Tracker System

latitude=51.52611
longitude=7.31475


Now need a Script to read this iformation from the SMS.

and send it to a Webserver. Like this.

http://webserver/setUserPosition.php?&latitude=51.52611&longitude=7.31475

The Webserver ist not runnning on the same Computer. It´s running
in the Internet.

So i need a Script that will take the information from the SMS and send it to the PHP script at the Webserver. After the PHP Script get the data,
I can see the Position on a Google Map on this webserver.

After a long time sarching with google , I get no solution.

But maybe someone can help me. Or can telme how to do this.

But sorry i´m only a normal user, not a Specialist

Many thanks for your help in advance

Regard

Jfoterek

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Define an eventhandler in the global part of smsd.conf:

eventhandler = /usr/local/bin/smsd_eventhander.sh

Create that file with the following content, and make it executable for smsd:

#!/bin/bash

if [ "$1" = "RECEIVED" ]; then

  TEXT=`sed -e '1,/^$/ d' < $2`

  if [[ "$TEXT" == *$'latitude='* ]]; then
    if [[ "$TEXT" == *$'longitude='* ]]; then

      URL="http://webserver/setUserPosition.php"

      for line in $TEXT
      do
        [ -n "$param" ] && param="$param&"
        param="$param$line"
      done

      FILE=$(mktemp /tmp/smsgps_XXXXXX)
      wget "$URL?$param" -O $FILE > /dev/null 2>&1
      #result=$(cat $FILE)
      rm $FILE
    fi
  fi
fi
 
'bash' Syntax Highlight powered by GeSHi


Restart smsd after changes are done.

The script is just an example with no error checking etc. In the SMS there must be "latitude=" and "longitude=" mentioned, otherwise SMS is ignored.

Member
Registered:
Aug 2011
Location: Castrop-Rauxel, Germany
Topic owner
Hallo Keke,

Many , Many thanks,

Let see if it works fine.

Regards

Jürgen

Login and Post Reply

Page:  1

SMSTools3 Community » Sample scripts / setups Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.