The php Function Curl_Setopt
The php function curl_setopt is used to set options for a CURL session identified by the ch parameter. The options that are available vary between versions of php and can depend on other cURL settings.
For example, if you are uploading a file to a server you will want to set the option CURLOPT_INFILESIZE which tells PHP what size the infile should be. This will ensure that the file is not uploaded until it has reached its maximum size.
Other useful cURL options are the CURLOPT_VERBOSE option which tells libcurl to be verbose and report what is happening. This can be useful for debugging purposes.
You can also pass a password prompt with the CURLOPT_RETURNTRANSFER option which allows you to display an HTML page containing the password for users who try to login on your site. This is especially useful if your site uses SSL or HTTPS connections.
The php function file_get_contents(ch) can be useful for grabbing the HTML content of a website from the server. This is the same as what the cURL function does, but it can be used within your own scripts instead of having to call another script to do the job for you.
You can also pass a preproxy with the CURLOPT_PROXY option which specifies a string holding a host name or dotted numerical IP address to be used as an optional SOCKS proxy for the cURL request. This is a great way to speed up your downloads, although note that the use of a preproxy will require that you have access to it.