【问题标题】:cURL POST request issuecURL POST 请求问题
【发布时间】:2016-09-17 16:19:33
【问题描述】:

我正在尝试使用 google safe browsing API 检查任何给定 URL 的分类。

根据 google safebrowsing API 页面 (https://developers.google.com/safe-browsing/v4/lookup-api) ,我向 POST 发出 HTTP 请求并检查网站分类。

作为回报,我没有看到任何对我发布的内容的响应。

收到回复:

#{}

使用的命令:

#curl -H "Content-Type: application/json" -X POST -d '  { "client": { "clientId": "Test", "clientVersion": "1.0.0" }, "threatInfo": { "threatTypes": ["MALWARE", "SOCIAL_ENGINEERING"], "platformTypes": ["WINDOWS"], "threatEntryTypes": ["URL"], "threatEntries": [ {"url": "http://www.facebook.com"} ] } }' https://safebrowsing.googleapis.com/v4/threatMatches:find?key=AIzaSyD1IMgjaHEza6e9m_jwtjBgPmJX0IMKKIs HTTP/1.1

我已经检查了命令,但不确定我在哪里犯了错误。有什么想法吗?

【问题讨论】:

    标签: curl post get httprequest httpresponse


    【解决方案1】:

    好的,根据 Google 的说法,您测试的网址 (www.facebook.com) 可能是安全的 - 因为如果我发出您的命令而不是 ianfette.org,我得到这个回应:

    {
      "matches": [
        {
          "threatType": "MALWARE",
          "platformType": "WINDOWS",
          "threat": {
            "url": "http://ianfette.org"
          },
          "cacheDuration": "300s",
          "threatEntryType": "URL"
        }
      ]
    }
    

    【讨论】:

    • 我们需要在我 X'ed 的地方放置一个有效的 API 密钥。无论如何都会使用 API 密钥进行更新。
    猜你喜欢
    • 2011-11-08
    • 1970-01-01
    • 2015-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多