What is cURL:
cURL is a PHP library and a command line tool (like wget) that helps you send files and also download data over HTTP and FTP. It supports proxies, you can transfer data over SSL connections, you can set cookies and even get files that are behind a login.
cURL allows transfer of data across a wide variety of protocols, and is a very powerful system. It’s widely used as a way to send data across websites, including things like API interaction and oAuth.
cURL stand for Client URL. CURL is a library to switch information via more than a few protocols like http, ftp, tftp and many others. First cURL library was released in 1997.
How To Use cURL:
To use curl in PHP is very straightforward. The basic idea of using curl in PHP is
- Initialize a curl session
- Set various options for the session
- Execute and fetch/send data from/to server
- Close the session
To complete our goal, the code is simple as ?
<?php
//step1
$cSession = curl_init();
//step2
curl_setopt($cSession,CURLOPT_URL,"http://www.google.com/search?q=curl");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
//step3
$result=curl_exec($cSession);
//step4
curl_close($cSession);
//step5
echo $result;
?>
- step1: Initialize a curl session use curl_init().
- step2: Set option for CURLOPT_URL. This value is the URL which we are sending the request to. Append a search term “curl” using parameter “q=”. Set option for CURLOPT_RETURNTRANSFER, true will tell curl to return the string instead of print it out. Set option for CURLOPT_HEADER, false will tell curl to ignore the header in the return value.
- step3: Execute the curl session using curl_exec().
- step4: Close the curl session we have created.
- step5: Output the return string.

Saved as a favorite, I really like your blog! Whoa!
This blog looks just like my old one! It’s on a entirely different topic
but it has pretty much the same page layout and design. Outstanding choice
of colors! Ahaa, its fastidious dialogue on the topic of this paragraph at this place at this blog,
I have read all that, so now me also commenting here. http://foxnews.net
LikeLike