<p>A remote site is supplying a data structure in a js file.</p>

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

<pre><code>&lt;head&gt;
    &lt;script type="text/javascript" src="http://www.example.co.uk/includes/js/data.js"&gt;&lt;/script&gt;
&lt;/head&gt;
</code></pre>

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

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

?>
```
```