array_values($filteredChunks), // Re-index the array after filtering 'links' => $links ]; // Output JSON header('Content-Type: application/json'); echo json_encode($response); } else { // If URL parameter is not set, return error header("HTTP/1.0 400 Bad Request"); echo "URL parameter is missing."; } ?>