2017-07-03 34 views
1

我有一个非常简单的邮递员请求,在邮递员中工作得很好。这只是一个GET请求到以下网址:请求邮递员的作品,但不是cURL

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

如果我问邮差,使卷曲的要求进行的,对我来说,它给了我这样的:

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'

结果是它永远挂起,永远不会给我一个回应。

任何想法可以做些什么来让cURL请求工作?

+0

更新:我发现了一个GET请求将在邮差,工作得很好,其我相信稍微简化了这个问题。 –

+0

然后从卷曲线中删除'-X GET' ... –

+0

就像我说的,我的'curl'命令刚刚从邮差中直接出来。我推断,无论'-X GET'是否存在,命令在功能上都是等效的,因此删除它不会改变任何内容。 (我尝试了不带'-X GET'的命令,只是为了确保我没有发疯,并且请求似乎以相同的方式失败。) –

回答

2

看来服务器已经禁止卷曲用户代理,也troute=t1需要cookies来另行设置返回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 
+0

这似乎是票。谢谢! –

相关问题