Created
November 2, 2011 09:31
-
-
Save necenzurat/1333252 to your computer and use it in GitHub Desktop.
Scrape Linkedin Connection number
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
<?php | |
/* i hate haotik | |
LICENSE: | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
0. You just DO WHAT THE FUCK YOU WANT TO. --> | |
*/ | |
$link = "http://www.linkedin.com/in/necenzurat"; | |
$data = file_get_contents("$link"); | |
function get_the_fucking_linkedin($data){ | |
preg_match('/<dd class="overview-connections">(.*?)<\/dd>/s', $data, $connections); | |
if (isset($connections) && !empty($connections)) | |
{ | |
$count = $connections[1]; | |
$conections_nr = preg_replace('/[^0-9_]/', '', $count); | |
} | |
return $conections_nr; | |
} | |
echo get_the_fucking_linkedin($data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment