DEV Community

BANIYA MANI TEJA
BANIYA MANI TEJA

Posted on

PhP Curl Basic code to scrape

curl_init() : initialize a cURL session.

curl_setopt() : you can set all your options for the transfer.

curl_exec() : you can execute the session.

curl_close() : you finish off your session.

Using Above 4 Function, I will fetch MovieBox Pro Website details.

<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://movieboxpro.live');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
curl_close($curl);
echo $result;
?>

Discussion (0)