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
| <?php
require_once('simple_html_dom.php');
require_once('connexion.php');
class Report{
public function strip_tags_content($text, $tags = '', $invert = FALSE) {
$text = str_ireplace('<br>', '', $text);
preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si#<img(.*?)>#s', trim($tags), $tags);
$tags = array_unique($tags[1]);
if(is_array($tags) AND count($tags) > 0) {
if($invert == FALSE) {
return preg_replace('@<(?!(?:'. implode('|', $tags) .')\b)(\w+)\b.*?>.*?</\1>@si', '', $text);
} else {
return preg_replace('@<('. implode('|', $tags) .')\b.*?>.*?</\1>@si', '', $text);
}
} elseif($invert == FALSE) {
return preg_replace('@<(\w+)\b.*?>.*?</\1>@si', '', $text);
}
return $text;
}
public function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
public function creat_report($moteur){
$data = Report::file_get_contents_curl("http://www.google.fr/search?hl=es&lr=lang_en&q=rimbaud ");
//$data = Report::file_get_contents_curl("http://www.google.fr/search?hl=fr&q=".urlencode($key['kw'])."&start=".$i."");
//$data = Report::file_get_contents_curl("http://www.google.fr/#hl=fr&xhr=t&q=youtube&cp=1&pf=p&sclient=psy&site=&source=hp&aq=0&aqi=&aql=&oq=y&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=fa24f318d197c09d&biw=1600&bih=703");
$html = str_get_html($data);
echo $data;
}
}
?> |
Partager