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

NAgain2 years 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 Tananaev2 years ago

What's the error?

NAgain2 years ago

In app nothing erros.

Log:

  • service started
  • network online
  • update location

(simple translate from russian)

Anton Tananaev2 years ago

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

NAgain2 years 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 Tananaev2 years ago

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

NAgain2 years ago

Bingo!

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

Thx! Worked perfectly!

NAgain2 years ago
  • sorry, not POST, GET - working!
Anton Tananaev2 years ago

Well, the app is sending POST requests.

NAgain2 years 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"
}