【问题标题】:Using cURL to replicate browser request使用 cURL 复制浏览器请求
【发布时间】:2013-03-19 13:28:53
【问题描述】:

我正在尝试使用 cURL 以 URL 的形式获取数据:

http://example.com/site-explorer/get_overview_text_data.php?data_type=refdomains_stats&hash=19a53c6b9aab3917d8bed5554000c7cb

它需要一个cookie,所以我先将它存储在一个文件中:

curl -c cookie-jar http://example.com/site-explorer/overview/subdomains/example.com

使用这些值尝试 curl:

curl -b cookie-jar -A "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" --referer "http://example.com/site-explorer/overview/subdomains/example.com" http://example.com/site-explorer/get_overview_text_data.php?data_type=refdomains_stats&hash=19a53c6b9aab3917d8bed5554000c7cb

【问题讨论】:

  • 真正的问题是什么?怎么了?

标签: bash cookies curl


【解决方案1】:

我突然想到一个问题:您没有引用 URL,这意味着诸如 &? 之类的字符将由 shell 解释,而不是传递给 curl。如果您使用的是完全静态的 URL,请将其括在单引号中,如 'http://blah.com/blah/blah...'

【讨论】:

    猜你喜欢
    • 2023-03-10
    • 2016-01-11
    • 2020-09-16
    • 1970-01-01
    • 1970-01-01
    • 2020-05-07
    • 2011-03-19
    • 1970-01-01
    相关资源
    最近更新 更多