Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wget can't download - 404 error

Tags:

wget

I tried to download an image using wget but got an error like the following.

--2011-10-01 16:45:42--  http://www.icerts.com/images/logo.jpg Resolving www.icerts.com... 97.74.86.3 Connecting to www.icerts.com|97.74.86.3|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2011-10-01 16:45:43 ERROR 404: Not Found. 

My browser has no problem loading the image. What's the problem? curl can't download either.

Thanks.

Sam

like image 743
Sam Kong Avatar asked Oct 01 '11 23:10

Sam Kong


1 Answers

You need to add the referer field in the headers of the HTTP request. With wget, you just need the --header arg :

wget http://www.icerts.com/images/logo.jpg --header "Referer: www.icerts.com" 

And the result :

--2011-10-02 02:00:18--  http://www.icerts.com/images/logo.jpg Résolution de www.icerts.com (www.icerts.com)... 97.74.86.3 Connexion vers www.icerts.com (www.icerts.com)|97.74.86.3|:80...connecté. requête HTTP transmise, en attente de la réponse...200 OK Longueur: 6102 (6,0K) [image/jpeg] Sauvegarde en : «logo.jpg» 
like image 154
blotus Avatar answered Sep 21 '22 12:09

blotus