I have an Html file that in the future will be much larger, and another PHP document. In the PHP document, I will have the option of obtaining the number of subscribers and viewing my YouTube channel, and I want that information from the PHP file to reach the tag of the Html.
This is the PHP document:
<?php
// https://www.googleapis.com/youtube/v3/channels?part=statistics&id={Channel-ID}&key={Api-key}
$apiKey = 'APi-key';
//https://www.youtube.com/channel/{channel_id}
$channel_id = 'Channel-ID';
$response = file_get_contents('https://www.googleapis.com/youtube/v3/channels?part=statistics&id='. $channel_id .'&key='. $apiKey);
$data = json_decode($response);
$subscriber_count = $data->items[0]->statistics->subscriberCount;
$view_count = $data->items[0]->statistics->viewCount;
//This is the PHP document
?>
And this is the Html document:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<ul>
<li>
<span>Subscribers:</span>
</li>
<li>
<span>Views:</span>
</li>
</ul>
</html>
</body>
</html>
So how can I send the subscriber information to the Span and the visualizations to the other span? Pliss help me to solve this.