Created
March 9, 2018 01:59
-
-
Save xaiborweb/d017f18b840f3e8613d5f366359ae45d to your computer and use it in GitHub Desktop.
curl olimpo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_time_limit(0); | |
function curl($url,$referer,$metodopost,$cookies){ | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, | |
array( | |
'Accept-Language:es-ES,es;q=0.9,de;q=0.8,pt;q=0.7', | |
'Connection:keep-alive' | |
) | |
); | |
if(!empty($referer)){ | |
curl_setopt($ch, CURLOPT_REFERER, $referer); | |
}else{ | |
curl_setopt($ch, CURLOPT_REFERER, $url); | |
} | |
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36'); | |
curl_setopt($ch, CURLOPT_HEADER, TRUE); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
if(!empty($metodopost)){ | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $metodopost); | |
} | |
if(!empty($cookies)){ | |
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); | |
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies); | |
} | |
curl_setopt($ch, CURLOPT_TIMEOUT, 5); | |
$source = curl_exec($ch); | |
curl_close($ch); | |
if(!empty($source)){ | |
return $source; | |
}else{ | |
return 'Forbidden'; | |
} | |
} | |
//curl embed | |
$olimpolink = 'http://widget.olimpo.link/playlist/?tmdb=284053'; | |
echo $htmlembed = curl($olimpolink,'','',''); | |
$cookie = 'C:\xampp\htdocs\bot\cookies\olimpo.txt'; | |
preg_match_all('|<li data-sdata="(.*)</li>|sU', $htmlembed, $embed); | |
$lembed = explode('"',$embed[1][0]); | |
$liembe = 'http://widget.olimpo.link/api/?name=olimpo.link.auto_checker&theme=1&data[sdata]='.urlencode($lembed[0]); | |
echo $hlembed = curl($liembe,$olimpolink,'',$cookie); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment