curl、wget 不返回任何内容

curl、wget 不返回任何内容

我正在尝试这个curl -I zomato.com | head -n 1

我没有得到任何回应。

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 
0  0    0    0     0   0     0       0   --:-  -:--     0:05:29 --:-   -:--     0 

该网站是否受防火墙保护?

Evenwget也无法在该网站上运行。其他网站如预期google.com返回200响应。

答案1

$ curl -I --max-redirs 1 "https://www.zomato.com/" 2>/dev/null  | grep "^location:" | awk '{print $2}'
https://www.zomato.com/some-location-in-mongolia

所以...

$ newURL=$(curl -I --max-redirs 1 "https://www.zomato.com/" 2>/dev/null  | grep "^location:" | awk '{print $2}'| grep -o ".*[a-z]"); curl -I "$newURL" | head -n 1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
HTTP/2 200 

不确定该论坛是否允许协助报废,但是;

wget --header "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" --header "Host: www.zomato.com" --header "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" "https://www.zomato.com/bangalore/restaurants/biryani"

相关内容