PHP: How to get (view) html source code of a website

Here is the PHP code to fetch the html source code of any website specified. fopen function is used to open the website URL. stream_get_contents is used to read the opened URL. The fetched code is displayed inside a textarea. $domain = 'http://example.com'; $handle = fopen($domain, 'r'); $content = stream_get_contents($handle); /** // alternative to stream_get_contents … Read more