rguchte
Posts: 5
Joined: Sat Jun 09, 2007 10:41 pm
Location: Netherlands

Problem $FRCMD and PHP

Fri Oct 29, 2010 10:22 pm

Hi,

I am having a problem I can't solve.
I hope there is someone who is willing to help me.

I am using a non supported device a KCS Traceme.
This device sends his encrypted data by GPRS to a script on my server.
The script de code's the data and sends it to the GpsGateServer 2.3.1.2076.

With HTTP it is working fine with the following code.

Code: Select all

//***************************************************************
<?php
$HttpData=
		    'longitude='.urlencode(substr($longitude,0,7))
			.'&latitude='.urlencode(substr($latitude,0,7))
			.'&altitude='.$altitude
			.'&speed='.$speedKNT
			.'&heading='.$heading
			.'&date='.$Date
			.'&time='.$time
			.'&imei='.$imei
			;
			
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "xxx.xxx.xxx.xxx/Gpsgate.aspx?$HttpData");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_PORT , 80);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$file_contents = curl_exec($ch);
curl_close($ch);
?>
//******************************************************************
The code works fine and gives no problem. The GpsGateServer gives the positions nicely.
The code has the disadvantage it can't include extra data as alarm or IO info.

For this reason I want to change to $FRCMD _SendMessage.

I have written the following code analogue to the HTTP code but I cant manage it to work properly.
In the Terminal I can see the data coming in but there seems to bee no triggering to take it in to the Server.
The code looks like this.

//***************************************************************  
<?php
$FRCMD= 
		'$FRCMD,'
		.$imei.','
		.'_SendMessage,'
                .','		
		.$latD.','
		.$longD.','
		.$altitude.','
		.$speedKNT.','
		.$heading.','
		.$date.','
		.$time.','
		."1"
		;


	$FRCMDOut="$FRCMD".'*'.CRC_NMEA($FRCMD);
			

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "xxx.xxx.xxx.xxx/GpsGate/?cmd=$FRCMDOut\r\n");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_PORT , 30175);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);

$file_contents = curl_exec($ch);
curl_close($ch);

>?
//**************************************************************
This code reports the following entry in the Terminal.

[2010-10-29 14:20:25] (xxx.93.174.173:2946/GpsGate/tcp) Disconnect

[2010-10-29 14:20:05] (xxx.93.xxx.173:2946/GpsGate/tcp) Client: t: xxx.xxx.xxx.xxx:30175[0x0D][0x0A]Accept: */*[0x0D][0x0A][0x0D][0x0A]

[2010-10-29 14:20:05] (xxx.93.xxx.173:2946/GpsGate/tcp) Client: GET /GpsGate/?cmd=$FRCMD,3582790001?????,_SendMessage,,5428.3781,N,0536.2835,E,0.0,0,23.04,291010,121703.720,1*7B[0x0D] HTTP/1.1[0x0D][0x0A]Hos

[2010-10-29 14:20:05] (xxx.93.xxx.173:2946/GpsGate/tcp) Connect

Is there someone out there who can help me solve this problem.

User avatar
johan
GpsGate
Posts: 14387
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Problem $FRCMD and PHP

Fri Oct 29, 2010 10:55 pm

Use port 8008 for HTTP. See page 19:
http://franson.com/gpsgateserver/GpsGateTrackerOne.pdf

http://yourserver.com:8008/GpsGate/?cmd=$FRCMD...



Regards,
Johan

GpsGate Support

rguchte
Posts: 5
Joined: Sat Jun 09, 2007 10:41 pm
Location: Netherlands

RE: Problem $FRCMD and PHP

Sat Oct 30, 2010 2:32 pm

Thanks Johan,

It was the solution. Port 8008 did the work.

This is the code i am using now in PHP.
Notice the ($ch, CURLOPT_PORT , 8008) for the port usage.
//****************************************************
$FRCMD=
'$FRCMD,'
.$imei.','
.'_SendMessage,'
.','
.$latD.','
.$longD.','
.$altitude.','
.$speedKNT.','
.$heading.','
.$date.','
.$time.','
."1"
.","
."Button1="."##Change##".','
."Button2=" ."##Change##".','
."Switch1=" ."##Change##"
."Switch2=" ."##Change##".','
."Analog1=" ."##Change##".','
."Analog2=" ."##Change##".','
."SOSButton=" ."##Change##".','
."BatteryLow=" ."##Change##".','
."Text1=" ."##Change##".','
."Text2=" ."##Change##"
;
$FRCMDOut="$FRCMD".'*'.CRC_NMEA($FRCMD);
//$FRCMDOut="xxx.xxx.xxx.xxx/gpsgate/?cmd=$FRCMD".'*'.CRC_NMEA($FRCMD)."\r\n"


$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "xxx.xxx.xxx.xxx/GpsGate/?cmd=$FRCMDOut");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); //put to 0 for $FRRET, respons
curl_setopt ($ch, CURLOPT_PORT , 8008);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);

$file_contents = curl_exec($ch); // Send url

curl_close($ch); // Close connection
//********************************************

Thanks for the fast support.
Great VLC Server.

rtoko
Posts: 18
Joined: Tue Feb 22, 2011 9:33 pm

RE: Problem $FRCMD and PHP

Mon Nov 10, 2014 11:45 am

Hi,

I'm currently setting up some Tracme devices with gpsgate server. Currently I have working server for data forwarding. For the same reasons like you I want to change to $FRCMD _SendMessage. Everything is working except CRC CHECKSUM is not working correctly.
So I'm interested to see the code for CRC_NMEA checksum ...

User avatar
johan
GpsGate
Posts: 14387
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Problem $FRCMD and PHP

Mon Nov 10, 2014 12:16 pm

No checksum is necessary.

Regards,
Johan

GpsGate Support

rtoko
Posts: 18
Joined: Tue Feb 22, 2011 9:33 pm

RE: Problem $FRCMD and PHP

Mon Nov 10, 2014 12:30 pm

So if I using port 8008 for FRCMD no checksum is necessary
Why is user "rguchte" putting
$FRCMDOut="$FRCMD".'*'.CRC_NMEA($FRCMD);
is this not checksum ...
I'm not so high programmer in PHP ...
One more question ... is it possible to integrate Tracme devices as native ... maybe from your side on request ...

Regards
Rtoko

Originally posted by johan

No checksum is necessary.

Regards,
Johan

GpsGate Support

manda007
Posts: 2
Joined: Tue Feb 13, 2018 6:29 pm

Re: Problem $FRCMD and PHP

Thu Feb 15, 2018 10:14 pm

Hello, have same problem i use KCS Traceme unsupported devices is it possible to get php code you make to forward traffic to GPS gateway server?

manda007
Posts: 2
Joined: Tue Feb 13, 2018 6:29 pm

Re: Problem $FRCMD and PHP

Fri Feb 16, 2018 7:47 am

I have same problem with same devices can i get php code?
Thanks!

savimakwo
Posts: 1
Joined: Tue Feb 20, 2018 12:44 pm
Contact: Website

Re: Problem $FRCMD and PHP

Tue Feb 20, 2018 12:46 pm

It was the best time to make this PHP and problem

Return to “GpsGate for Developers”