Last active
December 18, 2015 01:39
-
-
Save AlexKovax/5705710 to your computer and use it in GitHub Desktop.
A quick function to extract the name of the contributors from a Kiss Kiss Bank Bank "contributors" page
This file contains 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
<?php | |
//returns an array with the names extracted | |
function name_extractor($url){ | |
$res=array(); | |
$html = file($url); | |
foreach($html as $ligne) | |
if(preg_match("/class\=\"username\"\>(.+)\<\/a\>/",$ligne,$matches)) | |
array_push($res,$matches[1]); | |
return $res; | |
} | |
//usage example | |
print_r(name_extractor("http://www.kisskissbankbank.com/fr/projects/chiz-magazine-n-2/contributors")); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment