OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
quiz
/
backup
/
old_backup
/
backup
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
callback.php
1.55 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
oauth.php
2.63 KB
05/19/2025 10:07:16 AM
rw-r--r--
Editing: callback.php
Close
<?php session_start(); // Ensure the user is authenticated (access token is available in session) if (!isset($_SESSION['access_token'])) { die('You must authenticate first. Please go to <a href="oauth.php">OAuth Page</a>'); } // Access token for authentication $access_token = $_SESSION['access_token']; // YouTube API endpoint to get subscriptions $youtube_api_url = 'https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true'; // Step 1: Make the API request to YouTube with cURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $youtube_api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $access_token ]); $response = curl_exec($ch); curl_close($ch); if ($response === false) { die('Error in fetching subscriptions'); } // Step 2: Decode the JSON response and check if the user is subscribed to your channel $data = json_decode($response, true); // Provide the channel ID you want to check $channel_id_to_check = 'UC4MqIPSKb2FLYyPZQTDuqPQ'; // Replace with the channel ID you want to check $is_subscribed = false; // Loop through the subscriptions to check if the user is subscribed to your channel foreach ($data['items'] as $subscription) { if ($subscription['snippet']['resourceId']['channelId'] === $channel_id_to_check) { $is_subscribed = true; break; } } if ($is_subscribed) { echo 'You are subscribed to this channel.'; } else { echo 'You are not subscribed to this channel.'; } ?>