Hello friends, today I will tell you through this article how you can get the html source code of any website through php. So let’s go.
Extract HTML Source Code of a url using php, How to fetch html source code of a any website from url using php?, fetch html source code by url in php
It is very easy to get his html source from any website. You can do this very easily through the function of php. I will tell you 3 ways to get html source code.
Solution 1:-
<?php $data = file_get_contents("https://www.lipsum.com/"); $html_sourcecode_get = htmlentities($data); echo $html_sourcecode_get; ?>
Solution 2:-
<?php $data = file_get_contents('https://www.lipsum.com/'); echo htmlspecialchars($data); ?>
Solution 3:-
<?php $u = "https://www.lipsum.com/"; $ch = curl_init($u); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); $newquery = curl_exec($ch); echo $newquery_get = htmlentities($newquery); ?>