0

I'm trying to extract the facebook user id of html, is it possible?

I'm trying in this way but does not return a result.

function get_subs($url){
    $url = 'http://www.facebook.com/'.$url.'';
    $url = get_data($url);
    preg_match('/"profile_id": (.*?),/',$url,$result);
    $return = preg_replace("/[^\d]/", "", $result[1]);
    return $return;
}

$key = get_subs($url)
  • done any debugging, like checking of `$url` actually contains whatever you're looking for? and since you're fetching html, you should **NOT** be using regexes... – Marc B Jun 26 '15 at 14:11
  • @MarcB of course you can use RegExps to parse HTML ... it says so here : http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags (sorry, blatant excuse to refer to that old chestnut again) – CD001 Jun 26 '15 at 14:19
  • Scraping is against Facebook’s ToS. If you want to know anything about FB users, use an app and have them log in to that. – CBroe Jun 26 '15 at 15:43

1 Answers1

0

$url is profile name e.g 'gr.adriannicu' now i need extract id from html. This method works on instragram .

function get_followers($url){
    $url = 'http://instagram.com/'.$url.'/';
    $url = get_data($url);
    preg_match('/followed_by":(.*?),/',$url,$result);
    $return = preg_replace("/[^\d]/", "", $result[1]);
    return $return;
}

function return numbers of followers. I trying use this same method to extract facebook id based by profile name .