Usta pc de localhost çalişiyor. Server de olmuyor burdan bakınca ip ile alakali fakat orda takılıyorum.
Ben de şu şekil deniyordum.
PHP- Kodu:Hepsini Kopyala
<?php
if ( getenv ( 'HTTP_X_FORWARDED_FOR' )) { $pipaddress = getenv ( 'HTTP_X_FORWARDED_FOR' );
$ipaddress = getenv ( 'REMOTE_ADDR' );
echo "Your Proxy IP address is : " . $pipaddress . "(via $ipaddress )" ; }
else { $ipaddress = getenv ( 'REMOTE_ADDR' ); echo "Your IP address is : $ipaddress \r\n" ; }
function getPage ( $url , $referer , $ipaddress ){
$timeout = 30 ;
$curl = curl_init ();
if(strstr ( $referer , "://" )){
curl_setopt ( $curl , CURLOPT_REFERER , $referer );
}
curl_setopt ( $curl , CURLOPT_URL , $url );
curl_setopt ( $curl , CURLOPT_TIMEOUT , $timeout );
curl_setopt ( $curl , CURLOPT_USERAGENT , sprintf ( "Mozilla/%d.0" , rand ( 4 , 5 )));
curl_setopt ( $curl , CURLOPT_HEADER , $ipaddress );
curl_setopt ( $curl , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt ( $curl , CURLOPT_SSL_VERIFYPEER , 1 );
$html = curl_exec ( $curl );
curl_close ( $curl );
return $html ;
}
$html = getPage ( "https://securevideotoken.tmgrup.com.tr/webtv/secure?url=http://trkvz-live.ercdn.net/atvhd/atvhd.m3u8" , "https://www.atv.com.tr/webtv/canli-yayin" , 1 );
preg_match_all (
'#Url"\:"(.*?)"#si' ,
$html ,
$posts ,
PREG_SET_ORDER
);
foreach ($posts as $post ) {
$link = $post [ 1 ];
echo $link ;
echo getPage ( " $link " , " $ipaddress " , 1 );
}
?>
lokalhost da $link den gelen ile sorunsuz oluyor. Serverde getPage den ip mi yazıyor header de ok.
PHP- Kodu:Hepsini Kopyala
Your IP address is : xx xxx xxx http : //trkvz-live.ercdn.net/atvhd/atvhd.m3u8?st=IaZdxV1z1a8ItrmPE82MGg&e=1581775020HTTP/1.1 200 OK Date: Sat, 15 Feb 2020 01:23:40 GMT Content-Type: application/vnd.apple.mpegurl Transfer-Encoding: chunked Connection: keep-alive ETag: "5e474812-190" Access-Control-Allow-Origin: * X0: HIT Server: esrv Cache-Control: max-age=0, no-cache, no-store X1: EXPIRED #EXTM3U #EXT-X-VERSION:3 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1200000,NAME=720p,RESOLUTION=1536x864 atvhd_720p.m3u8?st=IaZdxV1z1a8ItrmPE82MGg&e=1581775020 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=800000,NAME=480p,RESOLUTION=1024x576 atvhd_480p.m3u8?st=IaZdxV1z1a8ItrmPE82MGg&e=1581775020 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=400000,NAME=360p,RESOLUTION=768x432 atvhd_360p.m3u8?st=IaZdxV1z1a8ItrmPE82MGg&e=1581775020 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=200000,NAME=240p,RESOLUTION=512x288 atvhd_240p.m3u8?st=IaZdxV1z1a8ItrmPE82MGg&e=1581775020
server de getPage yı kullanınca bu çıkıyor.