PHP cURL to get Website data

PHP cURL to get Website data

PHP Program:

<?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"/>
$siteName = $_POST['pname'];
    $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, "");
    $result = curl_exec($curl_connection);
    echo $result;     


php curl 1
php curl 2
php curl 3

Recommended Books:

1,152 total views, 1 views today

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.