我们正在尝试对 Google 商家工具进行提要刷新。
连接和发送工作完美,我们只是在发送 POST 而不是标准 GET 方法时遇到问题 ... 我们正在使用经典的asp
M_JSON 是 JSON content-api-key.json 文件
设置 xmlHttp = Server.CreateObject("Chilkat_9_5_0.Http")
xmlHttp.AuthToken = M_JSON
设置 sbResponseBody = Server.CreateObject("Chilkat_9_5_0.StringBuilder")
成功 = xmlHttp.QuickGetSb("https://shoppingcontent.googleapis.com/content/v2.1/xxxxxxxxx/datafeeds/xxxxxxxx/fetchNow",sbResponseBody)
Chilkat日志: 快速获取Sb: Dll日期: 2023 年 7 月 28 日 Chilkat版本:9.5.0.95 解锁前缀:SMPEUR 解锁状态:2 架构:小端; 32位 语言:ActiveX 详细日志记录:0 网址:https://shoppingcontent.googleapis.com/content/v2.1/xxxxxxxxx/datafeeds/xxxxxxxx/fetchNow http请求字符串: a_quickReq: 快速Http请求: http动词:GET 网址:https://shoppingcontent.googleapis.com/content/v2.1/xxxxxxxxx/datafeeds/xxxxxxxxx/fetchNow 打开Http连接: 直接打开与 HTTP 服务器的连接。 http主机名:shoppingcontent.googleapis.com http端口:443 tls:正确 HTTPS 安全通道已建立。 --openHttpConnection 构建快速请求: 生成起始线: startLine: GET /content/v2.1/xxxxxxxxx/datafeeds/xxxxxxxx/fetchNow HTTP/1.1 --genStartLine --buildQuickRequest 发送请求头: sendHeaderElapsedMs: 0 --发送请求头 读取响应头: 进程握手记录: 处理握手消息: 处理NewSessionTicket: 票证生命周期:0x2a300 Ticket_lifetime: 172800 票证年龄添加:0x77e75b8f 票证年龄地址:2011650959 m_nonce_size: 1 票长度: 229 --processNewSessionTicket --process握手消息 处理握手消息: 处理NewSessionTicket: 票证生命周期:0x2a300 Ticket_lifetime: 172800 票证年龄添加:0xcbc3ee81 票证年龄地址:3418615425 m_nonce_size: 1 票长度: 229 --processNewSessionTicket --process握手消息 --process握手记录 --读取响应头 状态代码:404 状态文本:未找到 --quickHttpRequest --a_quickReq 将ResponseBody转换为Utf8: 响应Hdr字符集:UTF-8 --convertResponseBodyToUtf8 由于 HTTP 响应代码而返回失败状态。 --httpRequestStr 失败的。 --QuickGetSb --ChilkatLog
要使用 Chilkat 在经典 ASP 中从 GET 请求切换到 POST 请求,请尝试:
Set xmlHttp = Server.CreateObject("Chilkat_9_5_0.Http")
xmlHttp.AuthToken = M_JSON ' Your authentication token
' Your JSON data as a string
jsonStr = "{""key"":""value""}" ' Replace with your actual JSON data
' The URL you're posting to
url = "https://shoppingcontent.googleapis.com/content/v2.1/xxxxxxxxx/datafeeds/xxxxxxxx/fetchNow"
' Sending the POST request
Set sbResponseBody = Server.CreateObject("Chilkat_9_5_0.StringBuilder")
success = xmlHttp.PostJson(url, jsonStr, sbResponseBody)
If success Then
' Process success
responseText = sbResponseBody.GetAsString()
' Do something with responseText
Else
' Handle error
errorMsg = xmlHttp.LastErrorText
' Do something with errorMsg
End If
确保将 URL 替换为您的实际端点,并将“key”:“value”替换为您的实际 JSON 数据。