Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Voir ou est utilisé $url et $name
- // enter bouyguestelecom login information
- // username = bouygtelecom email or phone number
- $username = "xxxxxx@bbox.fr";
- $password = "yyyyyy";
- $usernameurlencode = urlencode ( $username );
- $passwordurlencode = urlencode ( $password );
- $dest_host = "www.services.bouyguestelecom.fr/television-vod/tv-en-direct/channel/";
- $proxy_base_url = "/btv/";
- $url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
- $path = parse_url ( $url, PHP_URL_PATH );
- $segments = explode ( '/', rtrim ( $path, '/' ) );
- $name = $segments[count ( $segments ) - 2];
- $proxied_headers = array ( 'Set-Cookie', 'Content-Type', 'Cookie', 'Location' );
- // Variables you specify in the config file overwrite variables set above.
- /*foreach( array('./', '../', '../../') as $path_rel )
- {
- if( file_exists(dirname(__file__)."/$path_rel" . CONFIG_FILE) )
- {
- include(dirname(__file__)."/$path_rel" . CONFIG_FILE);
- break;
- }
- }*/
- //canonical trailing slash
- $proxy_base_url_canonical = rtrim ( $proxy_base_url, '/ ' ) . '/';
- //check if valid
- if ( strpos ( $_SERVER['REQUEST_URI'], $proxy_base_url ) !== 0 )
- {
- echo 'Erreur configuration';
- exit;
- }
- //remove base_url and optional index.php from request_uri
- $proxy_request_url = substr ( $_SERVER['REQUEST_URI'], strlen ( $proxy_base_url_canonical ) );
- if ( strpos ( $proxy_request_url, 'index.php' ) === 0 )
- $proxy_request_url = ltrim ( substr ( $proxy_request_url, strlen ( 'index.php' ) ), '/' );
- //final proxied request url
- $proxy_request_url = "https://" . rtrim ( $dest_host, '/ ' ) . '/' . $proxy_request_url;
- $ch1 = curl_init ( );
- curl_setopt ( $ch1, CURLOPT_URL, "https://www.services.bouyguestelecom.fr/television-vod/tv-en-direct/" );
- curl_setopt ( $ch1, CURLOPT_RETURNTRANSFER, 1 );
- curl_setopt ( $ch1, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0" );
- curl_setopt ( $ch1, CURLOPT_SSL_VERIFYPEER, 0 );
- curl_setopt ( $ch1, CURLOPT_SSL_VERIFYHOST, 0 );
- curl_setopt ( $ch1, CURLOPT_FOLLOWLOCATION, 0 );
- curl_setopt ( $ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
- curl_setopt ( $ch1, CURLOPT_HEADER, 1 );
- $headers1[] = 'GET /television-vod/tv-en-direct/ HTTP/1.1';
- $headers1[] = 'Host: www.services.bouyguestelecom.fr';
- $headers1[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0';
- $headers1[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
- $headers1[] = 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3';
- $headers1[] = 'Connection: keep-alive';
- $headers1[] = 'Upgrade-Insecure-Requests: 1';
- curl_setopt ( $ch1, CURLOPT_HTTPHEADER, $headers1 );
- $res1 = curl_exec ( $ch1 );
- curl_close ( $ch1 );
- if ( preg_match ( '#Location: (.*)#', $res1, $r1 ) )
- $l1 = trim ( $r1[1] );
- $min1 = str_replace ( "https://www.mon-compte.bouyguestelecom.fr", "", $l1 );
- preg_match_all ( '/^Set-Cookie:\s*([^;]*)/mi', $res1, $matchescookie1 );
- $cookies1 = array ( );
- foreach ( $matchescookie1[1] as $itemcookie1 )
- {
- parse_str ( $itemcookie1, $cookie1 );
- $cookies1 = array_merge ( $cookies1, $cookie1 );
- }
- $PHPSESSID = $cookies1['PHPSESSID'];
- $ch2 = curl_init ( );
- curl_setopt ( $ch2, CURLOPT_URL, $l1 );
- curl_setopt ( $ch2, CURLOPT_RETURNTRANSFER, 1 );
- curl_setopt ( $ch2, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0" );
- curl_setopt ( $ch2, CURLOPT_SSL_VERIFYPEER, 0 );
- curl_setopt ( $ch2, CURLOPT_SSL_VERIFYHOST, 0 );
- curl_setopt ( $ch2, CURLOPT_FOLLOWLOCATION, 0 );
- curl_setopt ( $ch2, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
- curl_setopt ( $ch2, CURLOPT_HEADER, 1 );
- $headers2[] = 'GET ' . $min1 . ' HTTP/1.1';
- $headers2[] = 'Host: www.mon-compte.bouyguestelecom.fr';
- $headers2[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0';
- $headers2[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
- $headers2[] = 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3';
- $headers2[] = 'Connection: keep-alive';
- $headers2[] = 'Upgrade-Insecure-Requests: 1';
- curl_setopt ( $ch2, CURLOPT_HTTPHEADER, $headers2 );
- $res2 = curl_exec ( $ch2 );
- curl_close ( $ch2 );
- preg_match_all ( '/^Set-Cookie:\s*([^;]*)/mi', $res2, $matchescookie2 );
- $cookies2 = array ( );
- foreach ( $matchescookie2[1] as $itemcookie2 )
- {
- parse_str ( $itemcookie2, $cookie2 );
- $cookies2 = array_merge ( $cookies2, $cookie2 );
- }
- $JSESSIONID = $cookies2['JSESSIONID'];
- preg_match ( '/name="lt" value="(.*?)"/', $res2, $matches2 );
- $lt = $matches2[1];
- $ch3 = curl_init ( );
- curl_setopt ( $ch3, CURLOPT_URL, "https://www.mon-compte.bouyguestelecom.fr/cas/login;jsessionid=" . $JSESSIONID . "?service=http%3A%2F%2Fwww.services.bouyguestelecom.fr%2Ftelevision-vod%2Fcheck_path" );
- curl_setopt ( $ch3, CURLOPT_RETURNTRANSFER, 1 );
- curl_setopt ( $ch3, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0" );
- curl_setopt ( $ch3, CURLOPT_SSL_VERIFYPEER, 0 );
- curl_setopt ( $ch3, CURLOPT_SSL_VERIFYHOST, 0 );
- curl_setopt ( $ch3, CURLOPT_FOLLOWLOCATION, 0 );
- curl_setopt ( $ch3, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
- curl_setopt ( $ch3, CURLOPT_HEADER, 1 );
- curl_setopt ( $ch3, CURLOPT_POST, 1 );
- $str = "username=" . $usernameurlencode . "&password=" . $passwordurlencode . "&rememberMe=true&_rememberMe=on<=" . $lt . "&execution=e1s1&_eventId=submit";
- curl_setopt ( $ch3, CURLOPT_POSTFIELDS, $str );
- $headers3[] = 'POST /cas/login;jsessionid=' . $JSESSIONID . '?service=http%3A%2F%2Fwww.services.bouyguestelecom.fr%2Ftelevision-vod%2Fcheck_path HTTP/1.1';
- $headers3[] = 'Host: www.mon-compte.bouyguestelecom.fr';
- $headers3[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0';
- $headers3[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
- $headers3[] = 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3';
- $headers3[] = 'Referer: https://www.mon-compte.bouyguestelecom.fr/cas/login?service=http%3A%2F%2Fwww.services.bouyguestelecom.fr%2Ftelevision-vod%2Fcheck_path';
- $headers3[] = 'Cookie: JSESSIONID=' . $JSESSIONID . '; NoCookieVu=0';
- $headers3[] = 'Connection: keep-alive';
- $headers3[] = 'Upgrade-Insecure-Requests: 1';
- $headers3[] = 'Content-Type: application/x-www-form-urlencoded';
- $headers3[] = "Content-Length: " . iconv_strlen ( $str, 'UTF-8' );
- curl_setopt ( $ch3, CURLOPT_HTTPHEADER, $headers3 );
- $res3 = curl_exec ( $ch3 );
- curl_close ( $ch3 );
- if ( preg_match ( '#Location: (.*)#', $res3, $r3 ) )
- $l3 = trim ( $r3[1] );
- $min3 = str_replace ( "http://www.services.bouyguestelecom.fr", "", $l3 );
- $l31 = str_replace ( "http://www.services.bouyguestelecom.fr", "https://www.services.bouyguestelecom.fr", $l3 );
- preg_match_all ( '/^Set-Cookie:\s*([^;]*)/mi', $res3, $matchescookie3 );
- $cookies3 = array ( );
- foreach ( $matchescookie3[1] as $itemcookie3 )
- {
- parse_str ( $itemcookie3, $cookie3 );
- $cookies3 = array_merge ( $cookies3, $cookie3 );
- }
- $CASPRIVACY = $cookies3['CASPRIVACY'];
- $SSOID = $cookies3['SSOID'];
- $SSO_ACTIVE = $cookies3['SSO_ACTIVE'];
- $CASTGC = $cookies3['CASTGC'];
- $bi = $cookies3['bi'];
- $CASTGR = $cookies3['CASTGR'];
- $ch4 = curl_init ( );
- curl_setopt ( $ch4, CURLOPT_URL, $l31 );
- curl_setopt ( $ch4, CURLOPT_RETURNTRANSFER, 1 );
- curl_setopt ( $ch4, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0" );
- curl_setopt ( $ch4, CURLOPT_SSL_VERIFYPEER, false );
- curl_setopt ( $ch4, CURLOPT_SSL_VERIFYHOST, 0 );
- curl_setopt ( $ch4, CURLOPT_FOLLOWLOCATION, 0 );
- curl_setopt ( $ch4, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
- curl_setopt ( $ch4, CURLOPT_HEADER, 1 );
- $headers4[] = 'GET ' . $min3 . ' HTTP/1.1';
- $headers4[] = 'Host: www.services.bouyguestelecom.fr';
- $headers4[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0';
- $headers4[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
- $headers4[] = 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3';
- $headers4[] = 'Connection: keep-alive';
- $headers4[] = 'Cookie: PHPSESSID=' . $PHPSESSID . '; NoCookieVu=0; SSOID=' . $SSOID . '; SSO_ACTIVE=' . $SSO_ACTIVE . '; bi=' . $bi . '';
- $headers4[] = 'Connection: keep-alive';
- $headers4[] = 'Upgrade-Insecure-Requests: 1';
- curl_setopt ( $ch4, CURLOPT_HTTPHEADER, $headers4 );
- $res4 = curl_exec ( $ch4 );
- curl_close ( $ch4 );
- preg_match_all ( '/^Set-Cookie:\s*([^;]*)/mi', $res4, $matchescookie4 );
- $cookies4 = array ( );
- foreach ( $matchescookie4[1] as $itemcookie4 )
- {
- parse_str ( $itemcookie4, $cookie4 );
- $cookies4 = array_merge ( $cookies4, $cookie4 );
- }
- $PHPSESSID1 = $cookies4['PHPSESSID'];
- if ( preg_match ( '#Location: (.*)#', $res4, $r4 ) )
- $l4 = trim ( $r4[1] );
- $min5 = str_replace ( "https://www.services.bouyguestelecom.fr", "", $proxy_request_url );
- $ch6 = curl_init ( );
- curl_setopt ( $ch6, CURLOPT_URL, $proxy_request_url );
- curl_setopt ( $ch6, CURLOPT_RETURNTRANSFER, 1 );
- curl_setopt ( $ch6, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0" );
- curl_setopt ( $ch6, CURLOPT_SSL_VERIFYPEER, false );
- curl_setopt ( $ch6, CURLOPT_SSL_VERIFYHOST, 0 );
- curl_setopt ( $ch6, CURLOPT_FOLLOWLOCATION, 0 );
- curl_setopt ( $ch6, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
- curl_setopt ( $ch6, CURLOPT_HEADER, 0 );
- $headers6[] = 'GET ' . $min5 . ' HTTP/1.1';
- $headers6[] = 'Host: www.services.bouyguestelecom.fr';
- $headers6[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0';
- $headers6[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
- $headers6[] = 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3';
- $headers6[] = 'Cookie: PHPSESSID=' . $PHPSESSID1 . '; NoCookieVu=0; SSOID=' . $SSOID . '; SSO_ACTIVE=' . $SSO_ACTIVE . '; bi=' . $bi . '';
- $headers6[] = 'Connection: keep-alive';
- $headers6[] = 'Upgrade-Insecure-Requests: 1';
- curl_setopt ( $ch6, CURLOPT_HTTPHEADER, $headers6 );
- $res6 = curl_exec ( $ch6 );
- curl_close ( $ch6 );
- $lien = str_replace ( 'https', 'http', str_replace ( "GlobalManifest.m3u8", "04.m3u8", $res6 ) );
- header ( "Location: " . $lien );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement