How would I be able to show 24 open, high & low on my site made with php I'm a self thought designer/developer that knows basic photoshp/css3/html5 and a little python/php. I have never used an API to fetch  stats, so can you please point me in the right direction?

I would love to show the 24 hr open, high &amp; low price of BTC on my php site, here is the api reference: https://docs.gdax.com/?php#get-historic-rates

Could any of you make a .php file with the necessary code for me? It would be such a great help.

I got this code to get started:

&lt;?php

// get the HTTP method, path and body of the request
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('php://input'),true);

// connect to the mysql database
$link = mysqli_connect('localhost', 'user', 'pass', 'dbname');
mysqli_set_charset($link,'utf8');

// retrieve the table and key from the path
$table = preg_replace('/[^a-z0-9_]+/i','',array_shift($request));
$key = array_shift($request)+0;

// escape the columns and values from the input object
$columns = preg_replace('/[^a-z0-9_]+/i','',array_keys($input));
$values = array_map(function ($value) use ($link) {
  if ($value===null) return null;
  return mysqli_real_escape_string($link,(string)$value);
},array_values($input));

// build the SET part of the SQL command
$set = '';
for ($i=0;$i&lt;count($columns);$i++) {
  $set.=($i&gt;0?',':'').'`'.$columns[$i].'`=';
  $set.=($values[$i]===null?'NULL':'"'.$values[$i].'"');
}

// create SQL based on HTTP method
switch ($method) {
  case 'GET':
    $sql = "select * from `$table`".($key?" WHERE id=$key":''); break;
  case 'PUT':
    $sql = "update `$table` set $set where id=$key"; break;
  case 'POST':
    $sql = "insert into `$table` set $set"; break;
  case 'DELETE':
    $sql = "delete `$table` where id=$key"; break;
}

// excecute SQL statement
$result = mysqli_query($link,$sql);

// die if SQL statement failed
if (!$result) {
  http_response_code(404);
  die(mysqli_error());
}

// print results, insert id or affected row count
if ($method == 'GET') {
  if (!$key) echo '[';
  for ($i=0;$i&lt;mysqli_num_rows($result);$i++) {
    echo ($i&gt;0?',':'').json_encode(mysqli_fetch_object($result));
  }
  if (!$key) echo ']';
} elseif ($method == 'POST') {
  echo mysqli_insert_id($link);
} else {
  echo mysqli_affected_rows($link);
}

// close mysql connection
mysqli_close($link);


Thanks!
A lot of the code you are sharing is unnecessary and unrelated to working with APIs in PHP. 

It's 3 basic steps. Define the URL of the API endpoint you want, fetch that URL in PHP, return the values to your page. 

Here's a simple example:

&lt;?php
//define API endpoint
$url = "https://api.gdax.com/products/BTC-USD/stats";

//fetch the url and convert the JSON into an associative array
$fgc = json_decode(file_get_contents($url), true);

//assign values to variables
$open = $fgc["open"];
$high = $fgc["high"];
$low = $fgc["low"];
$close = $fgc["close"];
?&gt;
&lt;html&gt;
&lt;h1&gt;My Website&lt;/h1&gt;
&lt;p&gt;Bitcoin 24 HR stats&lt;/p&gt;
Open: $&lt;?php echo $open; ?&gt;&lt;br&gt;
High: $&lt;?php echo $high; ?&gt;&lt;br&gt;
Low: $&lt;?php echo $low; ?&gt;&lt;br&gt;
Close: $&lt;?php echo $close; ?&gt;&lt;br&gt;
&lt;/html&gt;