PHP How do I get the broadcast from the bluetooth gateway over the HTTP protocol server?

How do I get the broadcast from the bluetooth gateway over the HTTP protocol server?
The model I am currently using is AB BLE Gateway V4

Please check the link Examples Written in PHP.

is it helpful?

I would like to ask whether the URL option in the configuration of the software on Windows is to fill in the location of the.txt file or to fill in the reading interface

it should be the reading interface. Do you mean the “HTTP Client” mode?

Let’s say your API URL is http://your.api.com/your-url , fill the form

  • HOST: your.api.com
  • PORT: 80
  • URI: your-url

Ok, thank you. Which demo should I use in the interface?I’ve seen a lot of demos where I don’t know which one to use

It’s inconvenient to add WeChat :咧嘴笑:

The current error: [msgpack] (php_msgpack_unserialize) Extra bytes

You should install the msgpack extension first. you can use pecl to do the job

pecl install msgpack

  • The msgpack server has already been installed

It’s just a warning and you should decoded the message already. Please also check the firmware version of the gateway

  • Is that right? I don’t know if I haven’t done this before

This is written by the interface

Please try to change the line 44 to

$cont = file_get_contents('php://input');

The code will fetch RAW post data to variable $cont

yes. go ahead

it seems you copied wrong code which work for Gateway V2. Please check this one instead

e.g.

    $data = msgpack_unpack($cont);
    $devices = $data['devices'];
    unset($data['devices']);

    echo "===== device data ====\n";
    print_r($data);

    foreach($devices as $v) {
        $adv = $parser->parse($v);
        echo "mac: $adv->macAddress rssi: $adv->rssi advertising data: ";
        echo $parser->hexString($adv->rawData);
        echo "\n";
    }

  • Is this the reason why the server did not get the data?
  • The number of replies from the account just now is limited. I’m sorry
  • The online interface address is:care.xd102.com/api/lanya/get_lanya

@aprilpea * Hello. Are you still here

hi,

Please note the BLE gateway will access the API. You can add a log to check what you got from gateway.

It will show warning message if you access the file directly.