Site icon Learn Web Development & Programming, Artificial Intelligence, WordPress, Shopify Articles

How to scrape data from website using CURL?

To scrap the data from website, Website must be public and open for scrapable.
In the blow code, just update the CURLOPT_URL to which websites data you want to scrap.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.tutorialswebsite.com/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
Exit mobile version