Header menu


Tuesday, 22 October 2013

PHP cURL simple tutorial

CURL is a reflective object-oriented programming language for interactive web applications whose goal is to provide a smoother transition between formatting and programming. It makes it possible to embed complex objects in simple documents without needing to switch between programming languages or development platforms.

The strong point of cURL is the number of data transfer protocols it supports. It supports FTP, FTPS, HTTP, HTTPS, TFTP, SCP, SFTP, Telnet, DICT, FILE and LDAP.

PHP cURL allows you to read websites, upload files, upload data, fetch data and lots of more stuff ... Now its the time to see what we can do we PHP cURL...

PHP cURL example-1 :

$ch = curl_init ("http://www.alexa.com");             /** Initialise curl with url of alexa.com **/

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);    /** Tell php curl that we want the data returned to us **/

$data = curl_exec ($ch);                            /** Execution of curl and result will be stored in $data **/

echo "<pre>";
print_r($data); /**preview result**/

To understand more about cURL defination visit : PHP cURL