JSON,CURL和Google的地理位置 [英] JSON, CURL and Google's geolocation

查看:191
本文介绍了JSON,CURL和Google的地理位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Google的地理位置浏览器位置服务。
到目前为止,当我尝试像

I am trying to use Google's geolocating "browserlocation" service. I have it figured so far that when I try something like

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一样

in the browser I get pretty accurate results, check it out for yourself. But when I want to use a JSON file to pass the data with curl like

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

我得到可怕的准确性(准确性:18000.0,)。
文件ssids.json的内容如下:

I get horrible accuracy ("accuracy" : 18000.0,). The content of the file ssids.json looks like this:

{
"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"
    }
]
}

我知道文件的内容没有正确传输,但我有NI的想法为什么...

Somehow I know the content of the file is not properly transmitted, but I have NI idea why ...

感谢您的帮助,谢谢。

推荐答案

您的macAddress格式需要

Your macAddress format needs to be


00:14:bf:28:80:69

00:14:bf:28:80:69


00-14-bf-28-80-69

00-14-bf-28-80-69

,我想你需要添加age:xx

also, I think you need to add "age" : xx

这篇关于JSON,CURL和Google的地理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆