what's the difference? i need to access a file or a web page on one web server from another web server. which one would you go for? what's the pros and cons of each?
Go for Curl, it supports gzip compression by default. All professional file fetching solutions use Curl as it's much faster and more flexible (for complex situations, such as form enetring etc.)
does curl come default with php? any custom installation required? also, what about fsockopen... any problems?
Not by default but any professional hosting solution will have included. Do a phpinfo and look for curl to be sure. Fsockopen through file_get_contents if pretty convenient for grabbing an entire page. No issues but if the page doesn't respond it will slow down your script whereas with Curl you can set a timeout.
curl needs to be installed on the system when you compile php for it to be included as an extension, however most systems have it installed, to test do <?php if(!function_exists( "curl_init") ) echo "No curl"; else echo "Curl installed"; ?> PHP: If you have curl then use it, as mentioned it's way faster than any other methods, like fsockopen and actual sockets. Also posting can be a pain in the ass with sockets ...... and useragents, and cookies