Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request works from Postman but not from cURL

Tags:

curl

postman

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?

like image 947
Jason Swett Avatar asked Jul 03 '17 15:07

Jason Swett


1 Answers

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
like image 76
Bertrand Martel Avatar answered Sep 24 '22 03:09

Bertrand Martel