what is cURL in php

cURL is a library that allows PHP applications to communicate with other servers. 

Example :

<?php
$url = “www.example.com”; // Desired URL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$returned = curl_exec($ch);
curl_close ($ch);
echo $returned;
?>

Leave a Reply

Your email address will not be published. Required fields are marked *