Troubleshooting: curl/wget Fetching HTML Instead of Files

Have you ever tried to download a file using curl or wget, only to end up with an HTML page instead? It’s likely that the URL isn’t pointing directly to the file. Let’s use downloading a file from GitHub as an example.

If you just click on the file li…


This content originally appeared on DEV Community and was authored by Lyner Lim

Have you ever tried to download a file using curl or wget, only to end up with an HTML page instead? It’s likely that the URL isn’t pointing directly to the file. Let’s use downloading a file from GitHub as an example.

If you just click on the file like this link (https://github.com/docker/docker-install/blob/master/install.sh), right click to inspect and you will see it is in html.

What we should do is click on the Raw to get this link (https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh).

Now, wget https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh or curl -O https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh will download the install.sh file to your local directory.


This content originally appeared on DEV Community and was authored by Lyner Lim


Print Share Comment Cite Upload Translate Updates
APA

Lyner Lim | Sciencx (2024-10-26T01:40:20+00:00) Troubleshooting: curl/wget Fetching HTML Instead of Files. Retrieved from https://www.scien.cx/2024/10/26/troubleshooting-curl-wget-fetching-html-instead-of-files/

MLA
" » Troubleshooting: curl/wget Fetching HTML Instead of Files." Lyner Lim | Sciencx - Saturday October 26, 2024, https://www.scien.cx/2024/10/26/troubleshooting-curl-wget-fetching-html-instead-of-files/
HARVARD
Lyner Lim | Sciencx Saturday October 26, 2024 » Troubleshooting: curl/wget Fetching HTML Instead of Files., viewed ,<https://www.scien.cx/2024/10/26/troubleshooting-curl-wget-fetching-html-instead-of-files/>
VANCOUVER
Lyner Lim | Sciencx - » Troubleshooting: curl/wget Fetching HTML Instead of Files. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/26/troubleshooting-curl-wget-fetching-html-instead-of-files/
CHICAGO
" » Troubleshooting: curl/wget Fetching HTML Instead of Files." Lyner Lim | Sciencx - Accessed . https://www.scien.cx/2024/10/26/troubleshooting-curl-wget-fetching-html-instead-of-files/
IEEE
" » Troubleshooting: curl/wget Fetching HTML Instead of Files." Lyner Lim | Sciencx [Online]. Available: https://www.scien.cx/2024/10/26/troubleshooting-curl-wget-fetching-html-instead-of-files/. [Accessed: ]
rf:citation
» Troubleshooting: curl/wget Fetching HTML Instead of Files | Lyner Lim | Sciencx | https://www.scien.cx/2024/10/26/troubleshooting-curl-wget-fetching-html-instead-of-files/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.