Fetching a URL with file_get_contents()

To retrieve the contents of a URL. For example, you want to include part of one web page in another page’s content, we can use the file_get_contents() function in php.

$page = file_get_contents('http://www.w3mentor.com/robots.txt');

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.