<?php
/**
 * Project:        M.VuiZ.Net
 * Author:         nampt.me <admin@vuiz.net>
 * Copyright:      © 2025 vuiz.net All rights reserved.
 */
error_reporting(0);
$link = isset($_POST['mediafire']) ? htmlspecialchars(rawurldecode($_POST['mediafire'])) : '';
$return = array();
if ($link && preg_match('#https?://#is',$link) ){
	include '../simple_html_dom.php';
	$html = file_get_html($link);
	$download = $html->find('div[class=download_link]',0)->find('a[aria-label=Download file]',0)->href; 
	$name = $html->find('div[class=dl-btn-label]',0)->title; 
	if(!empty($download) || !empty($name)){
		$return = [
			'success' => [
				'name' => $name ,
				'url' => $download ,   
			] ,
		];
	} else {
		$return['error'] = 'Có lỗi xảy ra, vui lòng thử lại sau!'; 
	}
}
echo json_encode($return, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
?>