CURL 到网站 API 响应不同的结果

CURL 到网站 API 响应不同的结果

正如标题所说,我使用 firefox 网络资源管理器来使用 API,我已经成功复制了几样东西,但是这个给出了不同的结果

因此,在网络中,查询是 GET 到https://www.binance.com/gateway-api/v1/Friendly/lending/project/customizedFixedProject/list?pageSize=3&pageIndex=1&status=ALL响应是一个有效的 JSON(至少 Firefox 和 Chrome 都显示了这一点)

{"code":"000000","message":"null","messageDetail":null,"data":[{"asset":"USDT","list":[{"projectId":"CUSDT7DAYS001","projectName":"USDT","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"224565","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDT","interestRate":"0.06310000","interestPerLot":"0.12090000","duration":"7","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"1"},{"projectId":"CUSDT14DAYSS001","projectName":"USDT","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"190167","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDT","interestRate":"0.06480000","interestPerLot":"0.24860000","duration":"14","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"1"},{"projectId":"CUSDT30DAYSS001","projectName":"USDT","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"676977","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDT","interestRate":"0.06660000","interestPerLot":"0.54720000","duration":"30","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"1"},{"projectId":"CUSDT90DAYSS001","projectName":"USDT","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"969489","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDT","interestRate":"0.07000000","interestPerLot":"1.72700000","duration":"90","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"1"}]},{"asset":"BUSD","list":[{"projectId":"CBUSD7DAYS001","projectName":"BUSD","lotsUpLimit":"500000","lotsLowLimit":"1","lotsPurchased":"30744","maxLotsPerUser":"100000","lotSize":"100.00000000","asset":"BUSD","interestRate":"0.06310000","interestPerLot":"0.12090000","duration":"7","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"2"},{"projectId":"CBUSD14DAYSS001","projectName":"BUSD","lotsUpLimit":"500000","lotsLowLimit":"1","lotsPurchased":"20988","maxLotsPerUser":"100000","lotSize":"100.00000000","asset":"BUSD","interestRate":"0.06480000","interestPerLot":"0.24860000","duration":"14","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"2"},{"projectId":"CBUSD30DAYSS001","projectName":"BUSD","lotsUpLimit":"500000","lotsLowLimit":"1","lotsPurchased":"151414","maxLotsPerUser":"100000","lotSize":"100.00000000","asset":"BUSD","interestRate":"0.06660000","interestPerLot":"0.54720000","duration":"30","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"2"},{"projectId":"CBUSD90DAYSS001","projectName":"BUSD","lotsUpLimit":"500000","lotsLowLimit":"1","lotsPurchased":"204698","maxLotsPerUser":"100000","lotSize":"100.00000000","asset":"BUSD","interestRate":"0.07000000","interestPerLot":"1.72700000","duration":"90","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"2"}]},{"asset":"USDC","list":[{"projectId":"USDC7DAYSS001","projectName":"USDC","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"26688","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDC","interestRate":"0.05310000","interestPerLot":"0.10180000","duration":"7","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"3"},{"projectId":"USDC14DAYSS001","projectName":"USDC","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"19296","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDC","interestRate":"0.05480000","interestPerLot":"0.21010000","duration":"14","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"3"},{"projectId":"USDC30DAYSS001","projectName":"USDC","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"20059","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDC","interestRate":"0.05660000","interestPerLot":"0.46520000","duration":"30","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"3"},{"projectId":"USDC90DAYSS001","projectName":"USDC","lotsUpLimit":"2000000","lotsLowLimit":"1","lotsPurchased":"94209","maxLotsPerUser":"500000","lotSize":"100.00000000","asset":"USDC","interestRate":"0.06000000","interestPerLot":"1.47940000","duration":"90","needKyc":false,"canAutoRenew":true,"withWhiteList":false,"withAreaLimitation":false,"status":"PURCHASING","displayPriority":"3"}]}],"total":3,"success":true}

但是,当我尝试使用curl访问同一个网站时,它会抛出一个通用的网络错误

curl https://www.binance.com/gateway-api/v1/friendly/lending/project/customizedFixedProject/list?pageSize=3&pageIndex=1&status=ALL 
HTTP/1.1 404 Not Found
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Date: Tue, 09 Feb 2021 21:19:48 GMT
Server: Tengine
Vary: Accept-Encoding
ETag: W/"5ff3db87-197a"
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubdomains
Content-Encoding: gzip
X-Cache: Error from cloudfront
Via: 1.1 da12738b8eacc0d543b2915c5e4262dd.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: SYD1-C2
X-Amz-Cf-Id: xS7LR0Qvm4onqjXxgaA7IG6LPrYNk3VJ0hFV0wFvk2Vk7oPTrRk8jw==

加载这个api的站点是https://www.binance.com/en/earn#fixed-item

这是一些截图

在此输入图像描述 在此输入图像描述

答案1

我设法让它与curl中的一些额外功能一起工作curl -XGET -H "Content-type: application/json" 'https://www.binance.com/gateway-api/v1/friendly/lending/project/customizedFixedProject/list?pageSize=3&pageIndex=1&status=ALL'

相关内容