Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6634821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:58:30+00:00 2026-05-25T22:58:30+00:00

I will begin by briefing as to what this actually should do… Fetch the

  • 0

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 = "&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD X... 
//All the rest of the html of the page.
"];localStorage.setItem(token[0], toStore[0]);</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:58:30+00:00Added an answer on May 25, 2026 at 10:58 pm

    You mean:

    tokens['".$t."'] = '".$rowtokens[5]."';
    

    Currently it is evaluating to:

    tokens[something = test];
    

    which is invalid and does not do what you want:

    • Everything is happening inside the property name; nothing is being set
    • You don’t have quotes which will probably mess up things

    If your code returns this:

    <script lang='text/javascript'>tokens[0 = tokenvalue here]; toStore[0 = "&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD X... 
    //All the rest of the html of the page.
    "];localStorage.setItem(token[0], toStore[0]);</script>
    

    then it’s not valid:

    • It’s <script type='text/javascript'>
    • I don’t know what you mean with 0 = tokenvalue here (you’re storing something in the number 0, which is not possible). Don’t you mean tokens[0] = tokenvalue?
    • There are newlines, so you should remove them as you currently have an unterminated string
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will begin this question by admitting I am very new to MVC. The
I will begin by saying that I'm a complete newbie as far as AppleScript
I need to begin working with milliseconds in .Net 3.0. The data will be
Will Java code built and compiled against a 32-bit JDK into 32-bit byte code
Will this code ever wait on the mutex inside the producer's void push(data) ?
Will this validate in XHTML? <span>hello<span>world</span></span>
Some time in the near future, I will begin developing a game engine. One
In my project, I need to embed audio (ex: mp3, etc) into a web
I am in the process of designing an app that will begin on an
I have a small page with two divs, clicked on the first div will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.