Share code PHP lấy Nội dung mọi Trang đơn giản không dùng cURL
Nay rảnh vọc lại cái trình php cùi bắp của mình .
Đây là mọi đoạn code cho dân gà code muốn làm tool leech đơn giản không dùng cURL
Demo: http://khanhsociu.tk
Xong... Đơn cmn giản.
Nguồn: khanhsociu
Đây là mọi đoạn code cho dân gà code muốn làm tool leech đơn giản không dùng cURL
Demo: http://khanhsociu.tk
<?php
$url = $_POST['url']; ///Trang cần leech
Echo 'Lấy nội dung Cap3x.Com';
Echo '<form action="?lay" method="post">
Link truyện
<input name="url" type="url" value=" http://" focus="focus"/><input type="submit"></form>';
$contents = file_get_contents($url); // Lấy nội dung link
$title = explode('<title>',$contents); //Lấy nội dung từ title đến hết
$title1 = explode('</title>',$title[1]); // Lấy mảng thứ 2
$nd = explode('<div class="content">',$contents); //Như trên
$ndr = explode('<div class="section-box related-posts">',$nd[1]); //lấy nội dung mảng
$text = $ndr[0]; //lấy mảng đầu tiên
$text = str_replace(array('<div align="center"><div class="well info">','<div id="extras">','</p>','<br />','<p class="text-center">','<br>','</div>'),'',$text); //thay thế nội dung
$text = str_replace(array('<h2 style="text-align: center;">','<h2>'),'[h2]',$text); // array để lấy nhiều kí tự
$text = str_replace(array('<h3>','</h3>','</h2>','<h4>','<strong>','</h4>','</strong>','
','<b class="text-danger">','</b>'),array('[h3]','[/h3]','[/h2]','[h4]','[strong]','[/h4]','[/strong]','
','',''),$text); //array 2 lần để thay thế (ví dụ <h3> => [h3])
$text = preg_replace('#<img src="(.*?)" alt="(.*?)" title="(.*?)" onerror="(.*?)" class="(.*?)"/>#is',"[img]$1''>
",$text); // thay thế kí tự không xác định
$text = preg_replace('#<a href="(.*?)" title="(.*?)" rel="(.*?)">Tải ảnh</a>#is',"",$text);
IF ($url){
Echo 'Tiêu đề là :
<textarea cols="16" rows="3">'.$title1[0].'</textarea>';
Echo '
Nội dung là:
<textarea cols="25" rows="30"> '.$text.'</textarea>';
}
Else
{
Echo 'Lỗi chưa nhập url';
}
?>
$url = $_POST['url']; ///Trang cần leech
Echo 'Lấy nội dung Cap3x.Com';
Echo '<form action="?lay" method="post">
Link truyện
<input name="url" type="url" value=" http://" focus="focus"/><input type="submit"></form>';
$contents = file_get_contents($url); // Lấy nội dung link
$title = explode('<title>',$contents); //Lấy nội dung từ title đến hết
$title1 = explode('</title>',$title[1]); // Lấy mảng thứ 2
$nd = explode('<div class="content">',$contents); //Như trên
$ndr = explode('<div class="section-box related-posts">',$nd[1]); //lấy nội dung mảng
$text = $ndr[0]; //lấy mảng đầu tiên
$text = str_replace(array('<div align="center"><div class="well info">','<div id="extras">','</p>','<br />','<p class="text-center">','<br>','</div>'),'',$text); //thay thế nội dung
$text = str_replace(array('<h2 style="text-align: center;">','<h2>'),'[h2]',$text); // array để lấy nhiều kí tự
$text = str_replace(array('<h3>','</h3>','</h2>','<h4>','<strong>','</h4>','</strong>','
','<b class="text-danger">','</b>'),array('[h3]','[/h3]','[/h2]','[h4]','[strong]','[/h4]','[/strong]','
','',''),$text); //array 2 lần để thay thế (ví dụ <h3> => [h3])
$text = preg_replace('#<img src="(.*?)" alt="(.*?)" title="(.*?)" onerror="(.*?)" class="(.*?)"/>#is',"[img]$1''>
",$text); // thay thế kí tự không xác định
$text = preg_replace('#<a href="(.*?)" title="(.*?)" rel="(.*?)">Tải ảnh</a>#is',"",$text);
IF ($url){
Echo 'Tiêu đề là :
<textarea cols="16" rows="3">'.$title1[0].'</textarea>';
Echo '
Nội dung là:
<textarea cols="25" rows="30"> '.$text.'</textarea>';
}
Else
{
Echo 'Lỗi chưa nhập url';
}
?>
Xong... Đơn cmn giản.
Nguồn: khanhsociu