This Season
 

How to Use Curl Attributes

Curl is an open-source utility that will retrieve all types of URLs over IP networks. It is a useful tool to make remote copies of Web pages or to maintain up-to-date copies of FTP files. Any protocol can be used, such as TELNET, FTP, HTTP, GOPHER or LDAP. This article will show how to use curl attributes to maximize its utility.

Related Searches:
    Difficulty:
    Moderately Challenging

    Instructions

      • 1

        Type the following: curl http://www.mysite.com to download a copy of the html page for www.mysite.com. The html will be printed to your screen (standard output).

      • 2

        Type the following: curl ftp://user@ftp.mysite.com/file.txt to download a file from an FTP site. You will be prompted for the user's password.

      • 3

        Restart the curl command. If your file transfer fails for any reason, restart the curl command with the -C attribute to have the transfer continue where it stopped, rather than restarting the entire transfer.

      • 4

        Use the -1 attribute. To get a file listing off an FTP site, use the -l attribute: curl -l ftp://user@ftp. mysite.com.

      • 5

        Obtain the HTTP header in the output. Use curl -i http://www.mysite.com. The output will be exactly what's sent to your browser in an HTTP retrieval.

      • 6

        Perform optional commands before and/or after a file transfer by typing curl -Q.

    Tips & Warnings

    • To retrieve multiple files, you can give your URL specification a range: curl ftp://user@ftp. mysite.com/file[a-z].txt.

    • The curl command is powered by the libcurl library. C programmers can use this library to write customized code to retrieve all kinds of URLs from their own C programs. See man libcurl(3) for details.

    • Curl will not retrieve an entire Web site recursively. Use the wget command instead.

    • Many environmental variables can affect the default operation of curl. See the bottom of the man page for curl for details.

    Related Searches

    Read Next:

    Comments

    You May Also Like

    Follow eHow

    Related Ads