1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <?php
// Permet de nettoyer un peu le code!
$_REQUEST['clean'] = ((!isset($_REQUEST['clean'])) ? true : $_REQUEST['clean']);
$_REQUEST['cleanjs'] = ((!isset($_REQUEST['cleanjs'])) ? true : $_REQUEST['cleanjs']);
$_REQUEST['cleancss'] = ((!isset($_REQUEST['cleancss'])) ? true : $_REQUEST['cleancss']);
$_REQUEST['cleanbody'] = ((!isset($_REQUEST['cleanbody'])) ? true : $_REQUEST['cleanbody']);
$_REQUEST['cleaniframe'] = ((!isset($_REQUEST['cleaniframe'])) ? true : $_REQUEST['cleaniframe']);
$_REQUEST['useProxy'] = ((!isset($_REQUEST['useProxy'])) ? true : $_REQUEST['useProxy']);
$proxy = ((!isset($_REQUEST['proxy'])) ? "xx.xx.xx.xx:xx" : $_REQUEST['proxy']);
// Liste de proxy
//http://www.hidemyass.com/proxy-list/
function curl_get_file_contents($url,$proxyActivation=false) {
global $proxy;
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_USERAGENT, " Googlebot/2.1 (http://www.googlebot.com/bot.html)" );
curl_setopt($c, CURLOPT_REFERER, $url);
curl_setopt($c, CURLOPT_COOKIEFILE,"Paramètres - Cookies et données de site.htm");
curl_setopt($c, CURLOPT_URL,$url);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
if($proxyActivation) {
curl_setopt($c, CURLOPT_PROXY, $proxy);
}
$contents = curl_exec($c);
//curl_close($c);
if ($contents)
return $contents;
else
return FALSE;
}
$body = curl_get_file_contents(urldecode($_REQUEST['urlSee']),$_REQUEST['useProxy']);
if ($_REQUEST['cleanbody']) {
preg_match('`<body[^>]*>(.*)</body[^>]*>`isU', $body, $matches);
$body = $matches[1];
}
if ($_REQUEST['cleanjs']) {
$body = preg_replace('@<noscript[^>]*?>.*?</noscript>@si', '', $body);
$body = preg_replace('@<script[^>]*?>.*?</script>@si', '', $body);
}
if ($_REQUEST['cleaniframe']) {
$body = preg_replace('@<iframe[^>]*?>.*?</iframe>@si', '', $body);
}
if ($_REQUEST['cleancss']) {
$body = preg_replace('@<style[^>]*?>.*?</style>@si', '', $body);
}
if ($_REQUEST['clean'])
echo htmlentities($body);
else
echo $body;
///////
if(is_string($body)){
$resultats = array();
$nb_resultats = preg_match('#<div class="menu_login_container rfloat">(.+)</div>#isU', $body, $resultats);
if($nb_resultats > 0){
echo $resultats[1];;
}
else{
echo 'Aucun résultat !';
}
}
else{
echo 'Erreur lors de la lecture du site !';
}
/* $resultats = array();
$body = preg_match('#<div id="yt-masthead">(.+)</div>#isU', $body, $resultats);
echo $body;
echo $resultats[1];*/
?> |
Partager