PHP cURL to get Website data
PHP Program:
[php]
<?php error_reporting(E_ALL ^ E_NOTICE); ?>
<form method="post" action="compare.php">
<div id="input" style="text-align: center; margin-top: 45px;">
Enter the website to Open :<input type="text" name="pname" id="pname" size="45"/>
</div>
</form>
<?php
$siteName = $_POST[‘pname’];
if($siteName){
$curl_connection = curl_init();
$url = "$siteName";
curl_setopt($curl_connection, CURLOPT_URL, $url);
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_connection, CURLOPT_REFERER, "https://www.registrar.usf.edu/");
$result = curl_exec($curl_connection);
echo $result;
}
?>
[/php]
Output:
Recommended Books: