<?php
header('Content-Type: application/json');
// Define the URL of the JSON data
$url = 'https://thedaddy.to/schedule/schedule-generated.json';
// Fetch the schedule data from the URL
function fetchJsonData($url) {
$ch = curl_init();
// Set cURL options securely
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Timeout in seconds
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects
// Set User-Agent to prevent bot detection
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3');
// Execute cURL request
$jsonData = curl_exec($ch);
if (curl_errno($ch)) {
// Handle cURL errors
http_response_code(500); // Internal Server Error
return json_encode([
'error' => 'Unable to fetch data',
'details' => curl_error($ch)
]);
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode !== 200) {
// Handle non-200 HTTP responses
http_response_code($httpCode);
return json_encode([
'error' => 'Unexpected HTTP response',
'code' => $httpCode
]);
}
// Decode the JSON data and check for errors
$responseData = json_decode($jsonData, true);
if (json_last_error() !== JSON_ERROR_NONE) {
http_response_code(500); // Internal Server Error
return json_encode([
'error' => 'Invalid JSON format',
'details' => json_last_error_msg()
]);
}
curl_close($ch);
return json_encode($responseData); // Ensure the response is always JSON
}
// Fetch and echo the JSON data
echo fetchJsonData($url);
?><!DOCTYPE html>
<html lang="en">
<head>
<script disable-devtool-auto src="https://cdn.jsdelivr.net/npm/disable-devtool@latest"></script>
<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>Live TV Stream Online Free | Soccer, NBA, NFL, MLB, NHL & More</title>
<meta name="description" content="Stream Live TV Online Free. Watch Soccer, NBA, NFL, MLB, NHL, Tennis, Cricket, Boxing, and other popular sports events online in HD.">
<meta name="keywords" content="live tv, live sports, soccer live stream, NBA live, NFL live, MLB live, NHL live, tennis live, cricket live, boxing live, stream free sports, HD sports stream">
<meta name="robots" content="index, follow">
<link rel="stylesheet" href="style.css">
<style>
.banner-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
width: 100%;
overflow: hidden;
}
.banner-container iframe {
max-width: 100%;
width: 728px;
height: 90px;
border: 0;
}
@media (max-width: 728px) {
.banner-container {
margin-top: 10px;
margin-bottom: -38px;
}
.banner-container iframe {
width: 100%;
height: auto;
}
}
</style>
<?php include 'ads/social-bar.php'; ?>
<?php include 'ads/popunders.php'; ?>
</head>
<body>
<div class="header">
<a id="homeLink" style="color: white;">
<h1 id="siteTitle"></h1>
</a>
<a id="channelsLink" target="_blank" style="color: white;">
<h1>Channel List</h1>
</a>
<a id="plusLink" target="_blank" style="color: white;">
<h1>18 Plus</h1>
</a>
<a id="moviesite" target="_blank" style="color: white;">
<h1>Movies / TV Series</h1>
</a>
</div>
<script>
const baseURL = `${window.location.protocol}//${window.location.hostname}`;
document.getElementById('homeLink').href = baseURL;
document.getElementById('channelsLink').href = `${baseURL}/channel.php`;
document.getElementById('plusLink').href = `${baseURL}/18plus.php`;
<?php include 'socialandsitelink/moviesitelink.php'; ?>
const siteName = window.location.hostname.split('.')[0];
document.getElementById('siteTitle').textContent = siteName.toUpperCase();
</script>
<div class="container">
<div class="search-bar">
<input type="text" id="search" placeholder="Search Channel Name..." oninput="searchEventOrChannel()">
</div>
<?php include 'socialandsitelink/telegramanddiscord.php'; ?>
<div id="schedule-container"></div>
<div class="footer">
<h5><p>This site does not store any files on our server. We only link to the media which is hosted on third-party services.</p></h5>
<h6><p id="copyright"></p></h6>
</div>
</div>
<script>
const domainName = window.location.hostname;
const year = new Date().getFullYear();
document.getElementById('copyright').innerText = `${domainName} © ${year}. All Rights Reserved.`;
const url = `${window.location.protocol}//${window.location.hostname}/json.php`;
async function fetchAndRenderSchedule() {
try {
const response = await fetch(url);
if (!response.ok) throw new Error('Network response was not ok');
const data = await response.json();
renderSchedule(data);
} catch (error) {
console.error('Error fetching data:', error);
}
}
function createEventElement(event) {
const eventElement = document.createElement('div');
eventElement.classList.add('event');
eventElement.setAttribute('data-event', event.event);
const channelsHTML = Array.isArray(event.channels) ? event.channels.map(channel => `
<div class="channel-item" data-channel="${channel.channel_name}">
<span>${channel.channel_name}</span>
<a href="watch.php?watch=${encodeURIComponent(channel.channel_id)}" target="_blank">Watch HD</a>
</div>
`).join('') : '';
eventElement.innerHTML = `
<div class="event-content">
<div class="event-time">${event.time}</div>
<div class="event-description">${event.event}</div>
</div>
<div class="channel-list" style="display: none;">
${channelsHTML}
</div>
`;
eventElement.onclick = () => {
const channelList = eventElement.querySelector('.channel-list');
channelList.style.display = channelList.style.display === 'block' ? 'none' : 'block';
};
return eventElement;
}
function renderSchedule(data) {
const scheduleContainer = document.getElementById('schedule-container');
scheduleContainer.innerHTML = '';
for (const [date, categories] of Object.entries(data)) {
const dateElement = document.createElement('div');
dateElement.classList.add('event-date');
dateElement.textContent = date;
scheduleContainer.appendChild(dateElement);
let popularEvents = [];
for (const [category, events] of Object.entries(categories)) {
const categoryElement = document.createElement('div');
categoryElement.classList.add('category-section');
const categoryTitle = document.createElement('h2');
categoryTitle.textContent = category;
categoryElement.appendChild(categoryTitle);
events.forEach(event => {
const eventElement = createEventElement(event);
categoryElement.appendChild(eventElement);
if (event.channels && event.channels.length > 8) {
popularEvents.push(eventElement);
}
});
scheduleContainer.appendChild(categoryElement);
}
if (popularEvents.length > 0) {
const popularSection = document.createElement('div');
popularSection.classList.add('category-section');
const popularTitle = document.createElement('h2');
popularTitle.textContent = 'Popular Events';
popularSection.appendChild(popularTitle);
popularEvents.forEach(event => {
popularSection.appendChild(event);
});
scheduleContainer.insertBefore(popularSection, dateElement.nextSibling);
}
}
}
fetchAndRenderSchedule();
function searchEventOrChannel() {
const searchValue = document.getElementById('search').value.toLowerCase();
const events = document.querySelectorAll('.event');
events.forEach(event => {
const eventName = event.getAttribute('data-event').toLowerCase();
const channels = event.querySelectorAll('.channel-item');
let showEvent = eventName.includes(searchValue);
channels.forEach(channel => {
const channelName = channel.getAttribute('data-channel').toLowerCase();
if (channelName.includes(searchValue)) {
showEvent = true;
}
});
event.style.display = showEvent ? 'block' : 'none';
});
}
</script>
</body>
</html>