我有这个网址 http://iptv-janberyan.cf:10000/b/active.html 当我输入代码并单击将其提交到 http://iptv-janberyan.cf:10000 我要从第二页中提取m3u链接
我要代码将用户代码和激活代码的IP地址发送到并单击submet按钮 http://iptv-janberyan.cf:10000/b/active.html
从花药页面获取m3u链接
我尝试了很多,但没有成功,这段代码是我自己的
function getUserIP() {
if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) {
$addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
return trim($addr[0]);
} else {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
}
else {
return $_SERVER['REMOTE_ADDR'];
}
}
$ip = getUserIP() ;
$url = 'http://iptv-janberyan.cf:10000/b/active.html';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Forwarded-For: $ip"));
$link = 'http://iptv-janberyan.cf:10000/';
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array("X-Forwarded-For: $ip"));
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array("Cookie: mgs=579060f907283604"));
curl_setopt($curl_handle, CURLOPT_URL,$link);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36');
curl_setopt($curl_handle, CURLOPT_REFERER, 'http://iptv-janberyan.cf:10000/b/active.html');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
//echo $query ;
$lines = explode("\n", $query);
$final= $lines[105];
$final = str_replace('<input type="text" class="fo_code" name="code" value="','',$final);
$final = str_replace('&output=mpegts" required/>','',$final);
echo $final ;