If I write:
$mypage=file_get_contents("www.mywebsite.com/mypage.htm");
The first time I run the script, file_get_contents() will surely make a HTTP request to http://www.mywebsite.com for mypage.htm, and get a response with the content of mypage.htm.
But every next time I run the script, will file_get_contents() get the real file on http://www.mywebsite.com?
Or it has some kind of cache on the localhost?
It does not. However, there will be a speed-up because the DNS resolution step may be faster on subsequent tries (till the cached entry expires), as the DNS records are cached by the server’s OS.