Created
March 16, 2014 01:09
-
-
Save iluxonchik/9576842 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_User($url){ | |
/***************************************************************** | |
* Retrieves the user from a paste | |
* -> This function is a bit hacky and doesn't have the best design | |
******************************************************************/ | |
$str = file_get_contents($url); | |
if(strlen($str) > 0){ | |
preg_match('/\<div class="paste_box_line2"\>(.*)\<\/div\>/', $str, $user); | |
$pieces = explode(' ', $user[1]); | |
if ($pieces[2]!='guest'){ | |
// if it's not a guest post get the username of the poster | |
preg_match('/\>(.*)\<\/a\>/', $pieces[2], $user); | |
return $user[1]; //user found | |
} | |
} | |
return false; // an error has occured somewhere | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment