Hostwinds VPS and Dedicated Server cleints who are creating web sites sometimes wish to test out their site on a local machine. If you are using a Linux system, and want to test out new URLs on your site, you can use either cURL or wget. Both commands serve a similar purpose: act as a command-line facilitator of HTTP requests, however, both can be used for so much more.
What do cURL and wget have in common?
Both cURL and wget are programs that are available to use and modify on your server. Both cURL and wget support HTTP and its secure version, HTTPS, which are the base protocols for web sites. They also both support FTP and SFTP, which is commonly used to upload files to servers.
cURL boasts a wide variety of supported protocols. According to curl’s web site, curl supports “DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, HTTP/2, cookies, user+password authentication (Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos), file transfer resume, proxy tunneling and more.” https://curl.haxx.se/
wget at this time, only supports HTTP- and FTP-based protocols, however, GNU Wget2 is actively being worked on at this time, so that might change in future versions.
Using cURL/wget to view a web site
You can use curl like so:
The first thing you’ll notice about curl is it just outputs everything to your terminal screen, so if you run it against your site, you’ll see it push the raw html to you screen:
Using wget is similar, but the end result is a little different.
As you can see, wget will actually download the file. It tries to save it as index.html, rather than displaying it directly to your screen.
- cPanel Web Disk Configuration in WHM
- Install LAMP Stack Manually (Ubuntu)
- What is the Difference Between Domain Hosting and Web Hosting?
- Common Reasons A Website Is Not Loading
- How to Add a Navigation Bar to Your Website
- WHM Restart Service: Mail Server (Exim)
- What Do I Do If I Get Hacked?
- Creating A Load Balancer
- How To Use WHMCS Support Tickets
- How to make your website Mobile Friendly