Need help with collect data from client in php-script on hosting (app settings)

NAgaina year ago

Hi all.

I'm write some php-script for collect any received data from Traccar Client (Android), but data is not received!

Script available by path like https://%host%/collector.php with valid SSL certificate.

In app settings I'm writing (server url):

  • https://%host%/collector.php
  • https://%host%:443/collector.php
  • http://%host%/collector.php
  • http://%host%:443/collector.php

but no result =(

3 or 4 years ago I'm do some like this and it's worked fine.

Anton Tananaeva year ago

What's the error?

NAgaina year ago

In app nothing erros.

Log:

  • service started
  • network online
  • update location

(simple translate from russian)

Anton Tananaeva year ago

If there's no error, it means that the data was uploaded successfully.

NAgaina year ago

hmmm... Can you tell me what is transferring from client app? Early I'm finding it in documentation on this site, but now I can't find it =(

Anton Tananaeva year ago

It's a POST request with a form-like payload.

NAgaina year ago

Bingo!

Early it's working like file_get_contents('php://input'); but now data in $_POST.

Thx! Worked perfectly!

NAgaina year ago
  • sorry, not POST, GET - working!
Anton Tananaeva year ago

Well, the app is sending POST requests.

NAgaina year ago

But $_POST in empty, data only in $_GET =)

converted to json:

{
    "id": "...",
    "timestamp": "1682871071",
    "lat": "...9079334",
    "lon": ...705813",
    "speed": "0.1951144212191999",
    "bearing": "75.52657318115234",
    "altitude": "170.09999084472656",
    "accuracy": "26.820999145507813",
    "batt": "41.0"
}