Ever wanted to fetch the HTML code for a web page without resorting to a browser? Or wanted to write a script to do something with that code? The command-line tool cURL, designed to handle URL manipulations and data transfer, is here to help you. Not only can you use it directly from the command line, but it also integrates smoothly into your PHP and Perl scripts; and it has a whole host of advanced options to handle cookies, authentication, and more.
Get started with cURL by trying it on the command line. The most basic usage just outputs the source of a web page straight to your terminal:
curl http://www.google.com
To save the output to a file, use the -o out.txt
option. When you do, you’ll see connection statistics on the command line instead of the source code as the page is retrieved, and the source will be saved in out.txt. Alternatively, you can get just the page information (and not the full source) with curl -I www.example.com
.
|
|
Leave a Reply