I will begin by briefing as to what this actually should do...
Fetch the entire contents of a web page, turn into a string, and save into persistant storage. However for some reason, it just... wont?
Ive used php's html entities, and then JSON Stringify, however it just fails to work.
My code is as follows...
//arrays set above
$url = "http://www.google.co.uk";
$handle = fopen($url, "r");
$contents = stream_get_contents($handle);
$contents = htmlentities($contents);
echo "<script lang='text/javascript'>var dataString = JSON.stringify('".$contents."'); tokens[".$t." = ".$rowtokens[5]."]; toStore[".$t." = dataString]; alert('CONTENT'); </script>";
EDIT :
That source code renders the following
<script lang='text/javascript'>tokens[0 = tokenvalue here]; toStore[0 = "<!DOCTYPE html PUBLIC "-//W3C//DTD X...
//All the rest of the html of the page.
"];localStorage.setItem(token[0], toStore[0]);</script>