Skip to content

Instantly share code, notes, and snippets.

@Laim
Created January 21, 2019 00:43
Show Gist options
  • Select an option

  • Save Laim/535df34cd32c98a729f9361cbfba3ae7 to your computer and use it in GitHub Desktop.

Select an option

Save Laim/535df34cd32c98a729f9361cbfba3ae7 to your computer and use it in GitHub Desktop.
TWNPLY lyrics page
<!DOCTYPE html>
<head>
<title>Lyrics Database</title>
</head>
<body>
<?php
error_reporting(0);
$artist_original = $_GET['artist'];
$song_original = $_GET['song'];
//
$artist = str_replace("The Maine", "maine", $artist_original);
$artist = preg_replace('/[^a-zA-Z0-9s]/', '', $artist);
//$artist = preg_replace('&', '', $artist);
$artist = strtolower($artist);
//$artist = htmlspecialchars($artist);
//--//
$song = str_replace(" ", "", $song_original);
$song = preg_replace('/[^a-zA-Z0-9s]/', '', $song);
$song = strtolower($song);
//
$azLyrics = file_get_contents("http://www.azlyrics.com/lyrics/" . $artist . "/" . $song . ".html");
if ( $azLyrics === false )
{
//echo "Sorry. Lyrics to that song could not be found. Some songs cannot be found due to symbol issues, one band is 'Of Mice & Men', it's because of the & sign. Ill fix it soon.";
} else {
$new = strstr($azLyrics, "<!-- start of lyrics -->");
$new2 = strstr($new, "<!-- end of lyrics -->", true);
echo $new2 . "<!-- end of lyrics -->
";
}
$plLyrics = file_get_contents("http://www.plyrics.com/lyrics/" . $artist . "/" . $song . ".html");
if ( $plLyrics === false )
{
echo "Sorry. Lyrics to that song could not be found. Some songs cannot be found due to symbol issues.";
} else {
$new = strstr($plLyrics, "<!-- start of lyrics -->");
$new2 = strstr($new, "<!-- end of lyrics -->", true);
echo $new2 . "<!-- end of lyrics -->
";
}
?>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment