要求邮递员提供作品,但不要求cURL提供作品 [英] Request works from Postman but not from cURL
问题描述
我有一个非常简单的Postman请求,在Postman中工作得很好。这只是对以下URL的GET请求:
http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884& ; quantity = 1& postalCode = 48103&纬度&经度& productId = 107531766& startIndexForPagination = 0& searchRadius = 0& pageType = product& ispu_or_sts = null& displayAllStoresFlag = false& displayAllStoreLink = false
>
如果我要求邮递员为我提出一个cURL请求,它将为我提供:
curl -X GET \
'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude=&经度=& productId = 107531766& startIndexForPagination = 0& searchRadius = 0& pageType = product& ispu_or_sts = null& displayAllStoresFlag = false& displayAllStoreLink = false'\
-H'cache-control:no-cache'\
-H'邮递员令牌:b4ae79c0-c3f0-8247-8c2f-306c43376039'
其结果是它挂了
任何想法都可以使cURL请求正常工作吗?
似乎服务器已禁止curl用户代理,还需要设置cookie troute = t1
,否则返回404:
curl -L -H'用户代理:Mozilla'\
-H'Cookie:troute = t1 ;'\
'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius = 0& pageType = product& ispu_or_sts = null& displayAllStoresFlag = false& displayAllStoreLink = false'-压缩
I have a pretty simple Postman request that works just fine in Postman. It's just a GET request to the following URL:
http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false
If I ask Postman to make a cURL request out of that for me, it gives me this:
curl -X GET \
'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude=&longitude=&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false' \
-H 'cache-control: no-cache' \
-H 'postman-token: b4ae79c0-c3f0-8247-8c2f-306c43376039'
The result is that it just hangs forever and never gives me a response.
Any idea what can be done to get the cURL request working?
It seems the server has banned curl user-agent, also the cookies troute=t1
needs to be set otherwise it returns 404 :
curl -L -H 'User-Agent: Mozilla' \
-H 'Cookie: troute=t1;' \
'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false' --compressed
这篇关于要求邮递员提供作品,但不要求cURL提供作品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!