waitfortea 发表于 2022-10-4 14:56:07

gm_xmlhttpRequest请求失败


请求行
```
POST https://dnschecker.org/ajax_files/api/364/A/pterclub.com?upd=1198.3115004900615
```
请求参数
```
dns_key=ip&dns_value=4&v=0.29&cd_flag=1
```

请求头
```Host: dnschecker.org
POST /ajax_files/api/364/A/pterclub.com?upd=1198.3115004900615 HTTP/2
Host: dnschecker.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
csrftoken: asdkS4+aFu2ceYAGMrgn1g6hSHeWd2wbA0pXw/XnJl96MnC6ssFZRRk4KKXnCr7veFdPdkxheTlCdXpRd0Y1a2VDdE5palhVc3BSazNQK1lSaHlUR2MyTWxDVT0=
X-Requested-With: XMLHttpRequest
Content-Length: 39
Origin: https://dnschecker.org
Connection: keep-alive
Referer: https://dnschecker.org/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
TE: trailers
```
gm_xmlhttpRequest
```
GM_xmlhttpRequest({
method:"POST",
url:"https://dnschecker.org/ajax_files/api/364/A/pterclub.com?upd=1198.3115004900615",
            headers: {
            "Content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0"
      },
data:"dns_key=ip&dns_value=4&v=0.29&cd_flag=1",
onload: function(res){
    console.log(res)
    console.log(typeof res)
}
```
错误
```
{readyState: 4, responseHeaders: 'cache-control: private, max-age=0, no-store, no-ca…ns: SAMEORIGIN\r\nx-xss-protection: 1; mode=block\r\n', finalUrl: 'https://dnschecker.org/ajax_files/api/364/A/pterclub.com?upd=1198.3115004900615', status: 403, statusText: '', …}
```
状态显示403,应该是请求失败了,想问下有没有大佬知道怎么办

李恒道 发表于 2022-10-4 14:56:08

csrftoken没有
如果还不好使就把所有头全部加上
一个个删看缺哪个不行
页: [1]
查看完整版本: gm_xmlhttpRequest请求失败