vb.net - 对 Google 自定义搜索 API 使用 VB GET 请求;未找到 URL 或非法请求
问题描述
我正在 VB 中创建一个程序并尝试向 Google 的自定义搜索 API 发出 GET 请求。
根据我尝试过的代码,我得到了两个回复:
在此服务器上未找到请求的 URL /customsearch/v1
或者
您的客户发出了格式错误或非法的请求
我已经尝试过使用变量,但我似乎无法弄清楚为什么会出现这些错误。这是我的代码:
Dim strHTTP As String
strHTTP = "GET /customsearch/v1"
strHTTP = strHTTP & "q=raptors"
strHTTP = strHTTP & "&key=" & mykey
strHTTP = strHTTP & "&cx=" & cxvar
strHTTP = strHTTP & " HTTP/1.1" & vbCrLf
strHTTP = strHTTP & "Host: googleapis.com" & vbCrLf
strHTTP = strHTTP & "Accept: application/json" & vbCrLf
strHTTP = strHTTP & vbCrLf
Web.SendData strHTTP
我从中得到的回应是:
在此服务器上未找到请求的 URL /customsearch/v1
当我应该得到搜索结果时。
解决方案
推荐阅读
- sdk - node.js sdk 3 中的 couchbase 一致性
- python - keras 的 Kaiming 初始化
- c# - ASP.NET CORE 和 EWS 托管 API 连接问题
- python - 从 JSON 文件计数到 python
- java - 这个接口和类是如何实现的?
- reactjs - Draft.js - 从数据库中检索格式化文本
- php - Laravel7如何自定义RegisterController以在用户选择时保存多个数据
- reactjs - React JS 用一个按钮改变一个值
- python - 如何将列表的元素除以另一个不同维度的列表的元素?
- python - 字典的键替换键?