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 80665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:20:18+00:00 2026-05-10T21:20:18+00:00

A remote site is supplying a data structure in a js file. I can

  • 0

A remote site is supplying a data structure in a js file.

I can include this file in my page to access the data and display it in my page.

<head>     <script type='text/javascript' src='http://www.example.co.uk/includes/js/data.js'></script> </head> 

Does anyone know how I use PHP to take this data and store in it a database?

  • 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. 2026-05-10T21:20:18+00:00Added an answer on May 10, 2026 at 9:20 pm

    You should GET that file directly, via, for example, CURL. Then parse it, if it comes in JSON, you can use json-decode.

    Simple example (slightly modified version of code found here):

    <?php $url = 'http://www.example.co.uk/includes/js/data.js'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); ...  $output = curl_exec($ch); $info = curl_getinfo($ch);  if ($output === false || $info['http_code'] != 200) {   $error = 'No cURL data returned for $url ['. $info['http_code']. ']';   if (curl_error($ch))     $error .= '\n'. curl_error($ch);   } else {   $js_data = json_decode($output);   // 'OK' status; save $class members in the database, or the $output directly,    // depending on what you want to actually do.   ... }  //Display $error or do something about it  ?> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fetching a .js file from a remote site that contains data I
I´m making a google instant-type of remote suggestion script with ajax on a site
I'm trying to retrieve JSON data from a remote site with Rails/Prototype. I've found
I have a form on my site which sends data to some remote site
i want to check remote url's page contents. IF remote site's page content contains
Am working on a project that requires uploading xml file to remote FTP site.
My Problem I am trying to load JSON encoded data from a remote site
I'm planning to set up log shipping to a remote site for disaster recovery
The site that I am working on is at a remote server. I want
How can I customise the Site Actions menu to remove or rename 'standard' menu

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.