Page 1 of 1

Problem $FRCMD and PHP

Posted: Fri Oct 29, 2010 10:22 pm
by rguchte
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.

RE: Problem $FRCMD and PHP

Posted: Fri Oct 29, 2010 10:55 pm
by johan
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

RE: Problem $FRCMD and PHP

Posted: Sat Oct 30, 2010 2:32 pm
by rguchte
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.

RE: Problem $FRCMD and PHP

Posted: Mon Nov 10, 2014 11:45 am
by rtoko
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 ...

RE: Problem $FRCMD and PHP

Posted: Mon Nov 10, 2014 12:16 pm
by johan
No checksum is necessary.

Regards,
Johan

GpsGate Support

RE: Problem $FRCMD and PHP

Posted: Mon Nov 10, 2014 12:30 pm
by rtoko
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

Re: Problem $FRCMD and PHP

Posted: Thu Feb 15, 2018 10:14 pm
by manda007
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?

Re: Problem $FRCMD and PHP

Posted: Fri Feb 16, 2018 7:47 am
by manda007
I have same problem with same devices can i get php code?
Thanks!

Re: Problem $FRCMD and PHP

Posted: Tue Feb 20, 2018 12:46 pm
by savimakwo
It was the best time to make this PHP and problem