Client URL Library Functions

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);
?>

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.