如果它在浏览器中工作,那么它是一种GET
方法而不是一种POST
方法。但如果你这样运行它GET
:
curl -d "query=bread&store=5461&size=20&offset=0" -X GET http://search.mobile.walmart.com/search
. 您将获得以下信息:
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access "http://search.mobile.walmart.com/search" on this server.<P>
Reference #18.2d00a81f.1504771199.d72c55
</BODY>
</HTML>
这基本上意味着沃尔玛不希望您使用除网络浏览器以外的任何东西访问其网站。但是您仍然可以尝试更改标题以模仿浏览器。还要更改UserAgent
字符串。在这个答案中查看如何做到这一点。这可能会有所帮助。
编辑
实际上我现在已经检查过了,使用
curl -X GET "http://search.mobile.walmart.com/search?query=bread&store=5461&size=20&offset=0"
效果很好。你不需要使用-d
with GET
。只需将查询字符串添加到 URL。