如何刮脸Facebook用户个人资料页面 [英] How to scrape a facebook user profile page

查看:133
本文介绍了如何刮脸Facebook用户个人资料页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用php刮脸Facebook用户个人资料页面。我尝试使用CURL,fsockopen和file_get_contents,但它没有返回处理的HTML页面。它只返回填充有JS代码的HTML页面。看来,Facebook加载页面使用Javascript。所以,我想知道,如何使用php获取处理的HTML页面。

I like to know how to scrape a facebook user profile page using php. I tried using CURL, fsockopen and file_get_contents but it is not returning the processed HTML page. It just return only the HTML page filled with JS code. It seems that, the facebook loading the page using the Javascript. So, I want to know, how to get the processed HTML page using php.

注意:
1.从Facebook注销。
2.点击用户的URL,例如: http://www.facbook.com/USERNAME

推荐答案

只需使用Facebook图表,更容易获得json格式的信息,而不是regexing html

just use facebook graph, so much easier to get the info in json format than regexing html

打开这个在chrome或一些体面的浏览器,知道如何处理json,

open this in chrome or some decent browser that knows what to do with json,

http://graph.facebook.com/php

{
   "id": "6358087478",
   "name": "PHP",
   "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/41787_6358087478_3246078_s.jpg",
   "link": "http://www.facebook.com/PHP",
   "category": "Product/service",
   "likes": 117991,
   "website": "www.php.net",
   "username": "PHP",
   "founded": "1994"
}

这篇关于如何刮脸Facebook用户个人资料页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆