Skip to content

Instantly share code, notes, and snippets.

@iluxonchik
Created March 16, 2014 01:09
Show Gist options
  • Save iluxonchik/9576842 to your computer and use it in GitHub Desktop.
Save iluxonchik/9576842 to your computer and use it in GitHub Desktop.
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