Skip to content

Instantly share code, notes, and snippets.

@Voker57
Created August 10, 2009 12:28
Show Gist options
  • Save Voker57/165164 to your computer and use it in GitHub Desktop.
Save Voker57/165164 to your computer and use it in GitHub Desktop.
<?php
// RIP LyricWiki. You were rather good.
// This script has the same interface as late LyricWiki
// Returning format is html only
error_reporting(0);
function encode($wtf)
{
return urlencode(preg_replace("/\\s+/","_",$wtf));
}
$artist = encode($_REQUEST["artist"]);
$title = encode($_REQUEST["song"]);
$page = file_get_contents("http://lyricwiki.org/$artist:$title");
if(preg_match("/<div\\s*class='lyricbox'\\s*>(.*)<\\/div\\s*>/msU",$page,$matches))
{
echo $matches[1];
} else
{
echo "Sorry, no matches";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment