Monday 11 June 2012

What is CURL ?




cURL
 means client URL, allows you to connect and communicate to many different types of servers with many different types of protocols.

It supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols.
To use CURL we use libcurl library. libcurl library is by default built-in in XAMPP. To check weather it is supports or not, check a phpinfo() program to see if you now have curl support listed. if it is not, then 
  • find php.ini file.
  • search for the line ;extension=php_curl.dll 
  • remove the semicolon from the beginning of the line.
  • save the file and restart apache.

check a phpinfo() again. it is supportable now.

libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT etc.

There are some function which we use, while using libcurl.

  • curl_init() : It Initialize a cURL session.
  • curl_setopt : It sets an option for a cURL transfer.e.g. (CURLOPT_URL, CURLOPT_POSTFIELDS, CURLOPT_RETURNTRANSFER etc. these are some predefined constants.)
  • curl_exec() : Run a cURL session.
curl_close() : Close a cURL session.

No comments:

Post a Comment