Skip to content

Instantly share code, notes, and snippets.

@necenzurat
Created November 2, 2011 09:31
Show Gist options
  • Save necenzurat/1333252 to your computer and use it in GitHub Desktop.
Save necenzurat/1333252 to your computer and use it in GitHub Desktop.
Scrape Linkedin Connection number
<?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