Я хочу использовать PHP для получения этого содержимого html, конечной целью я хочу получить ссылку m3u8. Он требует входа в систему http://tv24.vn/livetv/vtv1.html. Это информация для тестирования: user: h2132704 @trbvm. com pass: 12345678 Я пытался использовать curl POST, но безуспешно!
<?php
$username = '[email protected]';
$password = '12345678';
$loginUrl = 'http://tv24.vn/livetv/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'user='.$username.'&pass='.$password);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec($ch);
$return=file_get_contents("http://tv24.vn/livetv/vtv1.html"); preg_match('/file: "(.*?)"/', $return, $m3u8);
echo $m3u8;
?>
Любое решение? Большое спасибо !
Что-то вроде этого должно это сделать
$username = 'h2132704%40trbvm.com';
$password = '12345678';
$url = 'http://tv24.vn/account/login';
//login form action url
$postinfo = "email=".$username."&password=".$password;
$cookie_file_path = "cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
//set the cookie the site has for certain features, this is optional
curl_setopt($ch, CURLOPT_COOKIE, "cookiename=0");
curl_setopt($ch, CURLOPT_USERAGENT,
"Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
curl_exec($ch);
//page with the content I want to grab
curl_setopt($ch, CURLOPT_URL, "http://tv24.vn/livetv/vtv1.html");
//do stuff with the info with DomDocument() etc
$html = curl_exec($ch);
preg_match('/file: "(.*?)"/', $html, $m3u8);
print_r($m3u8[1]);
curl_close($ch);