PHP-如何在没有api的情况下获取Facebook用户id?
我正在尝试提取facebook用户id的html,有可能吗 我正在以这种方式尝试,但没有返回结果PHP-如何在没有api的情况下获取Facebook用户id?,php,html,facebook,Php,Html,Facebook,我正在尝试提取facebook用户id的html,有可能吗 我正在以这种方式尝试,但没有返回结果 function get_subs($url){ $url = 'http://www.facebook.com/'.$url.''; $url = get_data($url); preg_match('/"profile_id": (.*?),/',$url,$result); $return = preg_replace("/[^\d]/", "", $resu
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)
$url是配置文件名,例如'gr.adriannicu'现在我需要从html中提取id。 这种方法适用于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;
}
函数返回跟随者的数目。我尝试使用相同的方法根据配置文件名提取facebook id。完成了任何调试,比如检查
$url
是否实际包含您要查找的内容?既然你正在获取html,你就不应该使用正则表达式…@MarcB当然你可以使用正则表达式来解析html。。。这里是这么说的:(对不起,再次提到那个老板栗的明目张胆的借口)刮擦是违反Facebook的ToS的。如果你想了解FB用户的任何信息,请使用应用程序并让他们登录。