hi.
i was tring to show the source of a file in a path like this
http://www.somefile.com/index.html
or something like that.
but the dibbuger saies "wrong parameter count for...."
if i take file in a path such as "file.html" it works fine.
is there any way for displaying the souce of a distance file?
thank u
show_source
No, no, no! Of course you can't get source via HTTP--you would then be able to get the source code of every web page! The source code is hidden via HTTP because it is being parsed by PHP before being sent out (it is, afterall, a hypertext preprocessor).
You can only use local files when using show_source().
i dont want to view the php code, only the html code of cource.
show_source() would show source code of a PHP file using syntax highlighting for the various bits of the program. You won't have any PHP, so there would be no syntax highlighting. (There's no mention of show_source() taking URLs, and as the previous sentence notes, there wouldn't be much point if it did.)
So you might as well just use the file functions to read the page into a string, put it through htmlspecialchars() to stop it being rendered as HTML, and then echo it inside <pre> tags.
But depending on the browser being used, a person can view the source for themselves by going to the page in question and using the browser's "show source". Depending on the browser, it can even have syntax-highlighted HTML.
Incidentally, "wrong parameter count" means that the function wasn't given enough pieces of information in the following () to run. Or too many.
well... if you want to display the HTML code on the browser, then you could possible use;
$fp = fopen($path,"r")
then use fgets to download the HTML
then use something like
$test = "<HTML> </HTML>";
print htmlentities("$test");
to display the HTML code on the browser
sorry, if I misinterpreted your post, but hope it helps anyway
You could try something like this; it works on my current server setting.
Hope it helps!
<?php
$getfile = "index.html";
$file = "http://www.somefile.com/$getfile";
$fp = fopen($file,"r");
while(!feof($fp))
{
print nl2br(htmlentities(fgets($fp,1024)));
}
fclose($fp);
?>