Khamis, Disember 19, 2013

PHP : Cari lirik lagu

<html>
<head>
<title>SongLyric Searcher by 1.13.19.Hacker</title>
<link type="text/css" rel="stylesheet" href="http://1-13-19-hacker.eu.pn/Resources/css/style.css" />
</head>
<body>
<center><h1>SongLyric Searcher</h1>by <a href="http://www.facebook.com/1.13.19.Hacker" target="_blank">1.13.19.Hacker</a><form method="POST" action="" id="lirik_lagu" name="lirik_lagu" class="form-wrapper"><br />
<table border="0"><tr><td>Artist</td><td><input type="text" name="artis" value="<?php if(isset($_POST['artis'])){ echo htmlentities($_POST['artis']); } else { echo '';} ?>" /></td></tr>
<tr><td>Song Title</td><td><input type="text" name="judul" value="<?php if(isset($_POST['judul'])){ echo htmlentities($_POST['judul']); } else { echo '';} ?>" /></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" id="submit" value="Search" /></td></tr></table></form><br />
<?php
function get_string_between($string, $start, $end){
    $string = " ".$string;
    $ini = strpos($string,$start);
    if ($ini == 0) return "";
    $ini += strlen($start);
    $len = strpos($string,$end,$ini) - $ini;
    return substr($string,$ini,$len);
}

if($_POST['submit']=="Search"){
    if(isset($_POST['artis']) && !empty($_POST['artis']) && isset($_POST['judul']) && !empty($_POST['judul'])){
        $source = file_get_contents("http://www.songlyrics.com/".str_replace(" ", "-",$_POST['artis'])."/".str_replace(" ", "-",$_POST['judul'])."-lyrics/");
        if (!empty($source)) {
            $output = get_string_between($source, '<p id="songLyricsDiv" ondragstart="return false;" onselectstart="return false;" oncontextmenu="return false;" class="songLyricsV14">','</p>');
            //$output = str_replace("<br />","",$output);
            if(strpos($output, 'Sorry, we have no') !== FALSE){$output = "<script>alert('Lyric not found!')</script>";}
            echo ($output);
        }
        else{
            echo "<script>alert('Unable to grab data')</script>";
        }
    }
    else{
        echo "<script>alert('Please fill all textbox!')</script>";
    }
}
?></center>
</body></html> 
12-12-2013 05:49 AM 
* sumber : Aku pun lupa mana aku copy..haha..tuih

0 ulasan:

Catat Ulasan

Pesanan daripada penulis :
Selamat datang ke 0x2013LΣΣT. Sekiranya anda mempunyai persoalan, pandangan, permintaan, bantuan, cadangan dan sebagainya. Tinggalkan pesanan anda ke dalam kotak komen. Terima kasih !
- http://0x2013.blogspot.com -