Client URL Library Functions
Client URL Library Function (cURL):
cURL allow to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading , HTTP form based upload, proxies, cookies, and user-password authentication.
example:
<?php
$url = “http://www.sampledomain.net/”;
$file = “index.html”;
$ch = curl_init ($url);
$fp = fopen ($file, “w”) or
die(”Unable to open $file for writing.\n”);
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_FAILONERROR, true);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
if (!curl_exec ($ch)) {
print(”Unable to fetch $url.\n”);
}
curl_close ($ch);
fclose ($fp);
?>
