Tuesday, 30 June 2015

What is cURL and how use ?

cURL is a library that lets you make HTTP requests in PHP. Everything you need to know about it (and most other extensions) can be found in the PHP manual.


How to use :-

The first Curl script we are going to look at is the simplest Curl script that is actually useful - it will load a web page, retrieve the contents, then print it out. So, keeping the four-step Curl process in mind, this equates to:

Initialise Curl

Set URL we want to load

Retrieve and print the URL

Close Curl

Here is how that looks in PHP code:

<?php
    $curl = curl_init();
    curl_setopt ($curl, CURLOPT_URL, "http://www.php.net");
    curl_exec ($curl);
    curl_close ($curl);
?> 

No comments:

Post a Comment