you would need to use *_replace
functions on the retrieved code, or use DOM classes to alter the code. There is no way to modify file_get_contents
itself to add code
$script =<<<END
<script type="text/javascript" src="http://www.example.com/mysscript.js"></script>
</body>
END;
$html = file_get_contents($url);
$html = str_replace("</body>",$script,$html);
This assumes the content being grabbed has full html code, mainly includes the </body>
tag