Is there away to read a source code from another site? Source code as HTML, when you right click on a site and then "Source code".
I've tried:
<? $f = fopen ("http://www.example.com/f", r);
echo $f;
?>
It did not work. How do I do this?
Is there away to read a source code from another site? Source code as HTML, when you right click on a site and then "Source code".
I've tried:
<? $f = fopen ("http://www.example.com/f", r);
echo $f;
?>
It did not work. How do I do this?
You could use curl to grab the remote HTML, and when printing I'd be sure to sanitize it so the viewing browser doesn't try to render or execute script. (after all, you can't guarantee to control the contents of the remote HTML - it could be malicious)
Alternatively you could use shell commands to grab it to a temporary file, and read that file in. Wget or the curl binary itself could be prodded into doing this for you. (wget -O /tmp/sometempfile http://www.site.com/f) but note this is dangerous, and might set off "alarms" for sysadmins watching the system. Calling wget et al and dumping in /tmp/ is generally the first thing someone tries to do when they break into a PHP application.
That all depends on what you qualify as "source". To grab the output from a site, you could use
curl
:If you're talking about the server-side source of the page, then no, there's no way that you can do that (I hope that's not what you're talking about :))
Try
For reading contents (source) of a remote page, at some other website: