Wednesday, 13 June 2012

PHP/CURL Tutorial Part-1

Getting Started with PHP/CURL

This Tutorial assume that you have already install Web Server and running PHP and cURL support.

Let's Start with cURL...

cURL is a library which allows you to connect and communicate to many different types of servers with many different types of protocols. cURL means “Client for URL’s” or “Client URL Request Library”. cURL project produce two products libcurl and curl.

libcurl is free and easy to use client side URL transfer library, thread-safe, IPv6 compatible.
curl is command line tool for getting or sending files using URL syntax.

What is PHP/CURL?
The module for PHP that makes it possible for PHP programs to access curl function from within PHP. PHP/CURL is written by Sterling Hughes.

Using PHP/CURL you can:

  • Write Script to fetch complete web page.
  • Implement payment gateways’ payment notification scripts.
  • Download and upload files from remote servers.
  • Login to other websites and access members only sections.
  • Log on to a website and automate tasks

Lets check if CURL installed...

write a small PHP code and run it.

//Check for curl installation
if curl support is enabled in PHP, the phpinfo() function will display it is in its output as below.
If not then install libcurl first.

Or simply you can put a small code in PHP script to check whether Curl functions are available or not

 if (!function_exists('curl_init')){
 die('Sorry cURL is not installed!');

No comments:

Post a Comment