Kiến thức là vô biên, vì vậy hãy chia sẻ nó. Trên đây là một số công cụ và source mình sưu tầm được. Mong là nó sẽ hữu ích đối với bạn !
Code Google
Thứ Bảy, 10 tháng 5, 2014
Function get content Liric or dic
case "loibaihat_zing":
?>
<form method="get" role="form">
<legend>Form title</legend>
<div class="form-group">
<label for="">name</label>
<input name="word" type="text" class="form-control" id="" placeholder="">
</div>
<input type="hidden" name="name" value="Your_Account">
<input type="hidden" name="case" value="loibaihat_zing">
<input type="hidden" name="op" value="MyDomain">
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<?php
$lik= str_replace(" ", "+", ($_GET["word"])) ;
$url="http://mp3.zing.vn/tim-kiem/bai-hat.html?q=".$lik;
$html=get_page($url);
foreach ($html->find(".content-item h3 a._trackLink") as $value) {
if(strpos($value->href,"bai-hat")===false) {
continue;
}
echo "<h1>".$value->innertext."</h1>";
$url="http://mp3.zing.vn".$value->href."";
$html2=get_page($url);
foreach ($html2->find("._lyricItem") as $value2) {
$array_of_id_or_class=array("oLyric");
$name = implode('|', $array_of_id_or_class);
$regex = '#<(\w+)\s[^>]*(class|id)\s*=\s*[\'"](' . $name .
')[\'"][^>]*>.*</\\1>#isU';
echo (preg_replace($regex, '', $value2->innertext));
}
}
die;
break;
case "loibaihat":
?>
<form method="get" role="form">
<legend>Form title</legend>
<div class="form-group">
<label for="">name</label>
<input name="word" type="text" class="form-control" id="" placeholder="">
</div>
<input type="hidden" name="name" value="Your_Account">
<input type="hidden" name="case" value="loibaihat">
<input type="hidden" name="op" value="MyDomain">
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<?php
$lik= str_replace(" ", "+", unicode($_GET["word"])) ;
$url="http://loibaihat.mobi/tim-kiem/loi-bai-hat.html?search=".$lik;
$html=get_page($url);
foreach ($html->find(".item a") as $value) {
echo "<h1>".$value->innertext."</h1>";
echo "<h5>http://loibaihat.mobi".$value->href."</h5>";
// $url="http://loibaihat.mobi".$value->href."";
// $html2=get_page($url);
// foreach ($html2->find(".lyric") as $value2) {
// echo $value2->innertext;
// }
// echo "<pre>";
// print_r($value);
// echo "</pre>";
}
die;
break;
case "dict":
?>
<form method="get" role="form">
<legend>Form title</legend>
<div class="form-group">
<label for="">name</label>
<input name="word" type="text" class="form-control" id="" placeholder="">
</div>
<input type="hidden" name="name" value="Your_Account">
<input type="hidden" name="case" value="dict">
<input type="hidden" name="op" value="MyDomain">
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<?php
$url="http://vdict.com/".$_GET["word"].",1,0,0.html";
$html=get_page($url);
foreach ($html->find(".word_title") as $value) {
echo "<h1>".$value->innertext."</h1>";
// echo "<pre>";
// print_r($value);
// echo "</pre>";
}
foreach ($html->find(".pronounce") as $value) {
echo "<p>".$value->innertext."</p>";
// echo "<pre>";
// print_r($value);
// echo "</pre>";
}
foreach ($html->find(".phanloai") as $value) {
echo "<h3>".$value->innertext."</h3>";
// echo "<pre>";
// print_r($value);
// echo "</pre>";
}
foreach ($html->find(".list1") as $value) {
echo "<p>".$value->innertext."</p>";
// echo "<pre>";
// print_r($value);
// echo "</pre>";
}
die;
break;
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét