Stickbread
Programmer
After I download the page, I use PHP's addslashes method to every line, and then I just wrap every line in a document.write. Here is the script (script.php):
Then to display a webpage, I use:
<script language="JavaScript" src="script.php?url=http://www.google.com"></script>
However, this is not working on all web pages. For example, it works for but not for and most others. My guess is that PHPs addslashes does not escape the proper characters to generate a javascript friendly string.
Could somebody help me get this script working? It's rather urgent.
Code:
$url = $_GET["url"];
$file = file("$url");
for($i = 0; $i < count($file); $i++)
{
$line = $file[$i];
$line = substr($line, 0, strlen($line)-1); // removes the new line character
$line = addslashes($line);
$str = "document.write(\"$line\");\n";
print($str);
}
Then to display a webpage, I use:
<script language="JavaScript" src="script.php?url=http://www.google.com"></script>
However, this is not working on all web pages. For example, it works for but not for and most others. My guess is that PHPs addslashes does not escape the proper characters to generate a javascript friendly string.
Could somebody help me get this script working? It's rather urgent.