此 curl 请求返回空的方括号 []:
curl "https://www.bathnes.gov.uk/NodeAPI/geoDataLookup/getGeoJSON/-2.8530120849609375/51.263633525637/-2.126541137695313/51.456574106519724/11" -X POST -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "Accept-Language: en-GB,en;q=0.5" -H "Accept-Encoding: gzip, deflate, br" -H "Content-Type: application/json; charset=utf-8" -H "X-Requested-With: XMLHttpRequest" -H "Origin: https://www.bathnes.gov.uk" -H "DNT: 1" -H "Connection: keep-alive" -H "Referer: https://www.bathnes.gov.uk/webforms/planning/" -H "Cookie: banes-cookie-accept=2" -H "Sec-Fetch-Dest: empty" -H "Sec-Fetch-Mode: cors" -H "Sec-Fetch-Site: same-origin" --data-raw "^[""MLYR-54335""^]"
它是从这个网站获得的:
https://www.bathnes.gov.uk/webforms/planning/#mapSearch
(在 Firefox 中)按 F12 -> 网络选项卡。按 F5 刷新并查找唯一的 POST 方法。右键单击它->复制值->复制 POST 数据。
如果双击该 POST 方法,它会在新选项卡中返回预期数据。
我不确定是否需要标题,因为这会返回相同的空括号:
curl "https://www.bathnes.gov.uk/NodeAPI/geoDataLookup/getGeoJSON/-2.8530120849609375/51.263633525637/-2.126541137695313/51.456574106519724/11" -X POST --data-raw "^[""MLYR-54335""^]"