JSON,CURL和Google的地理位置

我正在尝试使用Google的地理位置“browserlocation”服务.

到目前为止,我已经想到了当我尝试类似的东西时

https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true&
wifi=mac:00-14-bf-28-80-69|ssid:10160|ss:-26&
wifi=mac:00-26-50-38-ca-11|ssid:2WIRE084|ss:-69&
wifi=mac:34-ef-44-7c-0e-b1|ssid:2WIRE202|ss:-70&
wifi=mac:00-1f-b3-64-b3-f1|ssid:2WIRE605|ss:-74&
wifi=mac:00-26-50-e3-1f-81|ssid:2WIRE137|ss:-79&
wifi=mac:00-1d-5a-ef-4d-b9|ssid:2WIRE495|ss:-81&
wifi=mac:c0-83-0a-69-c4-b9|ssid:2WIRE431|ss:-81&
wifi=mac:30-46-9a-43-3d-71|ssid:MacAdamN|ss:-84&
wifi=mac:64-0f-28-bf-e2-91|ssid:2WIRE552|ss:-86&
wifi=mac:00-14-d1-cd-a4-88|ssid:TRENDnet637|ss:-86&
wifi=mac:00-23-5e-b0-70-90|ssid:AppleWiFi|ss:-86&
wifi=mac:00-23-5e-af-39-a0|ssid:AppleWiFi|ss:-86&
wifi=mac:00-1d-d1-55-0d-90|ssid:HOME-0D92|ss:-88

在浏览器中我得到了非常准确的结果,请自行检查.
但是,当我想使用JSON文件传递curl数据时

curl -i -X POST -d @ssids.json "https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true"

我的准确度很差(“准确度”:18000.0,).
文件ssids.json的内容如下所示:

{
"wifi_access_points": [
    {
        "macAddress": "00-14-bf-28-80-69",
        "signalStrength": "-26"
    },
    {
        "macAddress": "00-26-50-38-ca-11",
        "signalStrength": "-69"
    },
    {
        "macAddress": "00-26-50-38-ca-11",
        "signalStrength": "-69"
    },
    {
        "macAddress": "34-ef-44-7c-0e-b1",
        "signalStrength": "-70"
    },
    {
        "macAddress": "00-1f-b3-64-b3-f1",
        "signalStrength": "-74"
    },
    {
        "macAddress": "00-26-50-e3-1f-81",
        "signalStrength": "-79"
    },
    {
        "macAddress": "00-1d-5a-ef-4d-b9",
        "signalStrength": "-81"
    },
    {
        "macAddress": "c0-83-0a-69-c4-b9",
        "signalStrength": "-81"
    },
    {
        "macAddress": "30-46-9a-43-3d-71",
        "signalStrength": "-84"
    },
    {
        "macAddress": "64-0f-28-bf-e2-91",
        "signalStrength": "-86"
    },
    {
        "macAddress": "00-14-d1-cd-a4-88",
        "signalStrength": "-86"
    },
    {
        "macAddress": "00-23-5e-b0-70-90",
        "signalStrength": "-86"
    },
    {
        "macAddress": "00-23-5e-af-39-a0",
        "signalStrength": "-86"
    },
    {
        "macAddress": "00-1d-d1-55-0d-90",
        "signalStrength": "-88"
    }
]
}

不知怎的,我知道文件的内容没有正确传输,但我知道为什么……

非常感谢帮助,谢谢.

最佳答案 您的macAddress格式需要

00:14:bf:28:80:69

而不是这个

00-14-bf-28-80-69

另外,我认为你需要添加“年龄”:xx

点赞