/* gets the data from a URL */ function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); return $data; }

$returned_content = get_data( 'https://www.skptricks.com' );

<?php $URL = "http://www.skptricks.com" file_get_contents($URL) ?>

In this tutorial we are going to learn. Nowadays it is a common and useful technique to extract data from another server. By this way we can extract useful data like meta tag details, html attribute/ tags details.PHP's cURL library, which often comes with default shared hosting configurations, allows web developers to complete this task.Lets see the below function which will extract information from specific URL.To call get_data() function, you need to mention below statement in PHP tag.Alternatively, you can use the file_get_contents function remotely, but many hosts don't allow this.