tags:

views:

67

answers:

2

Hi,

for one project, i need to get the facebook source page (html one) via a php application. i try lot of method like curl, file_get_content, change my ini_set, etc.... but facebook never let me get the html result file. Does anyone can help ? for example this page :

ini_set('user_agent', $_SERVER['HTTP_USER_AGENT']);
$data = file_get_contents("http://apps.facebook.com/is_cool/?cafe_action=album&view=scroll",0);
Print strip_tags($data,"");

Thanks a lot. Damien

Comment 1 : - I need to create 2 application. I want to parse the html code to get some information from one to the other. I don't want to duplicate or take the facebook code. I just want to make a "view source" (like IE or firefox) and put it on a file, without ask my users. When my user is logged in my first application, i just want to is is credential to get the other content.

+1  A: 

The reason you're having problems is that the majority of the facebook homepage content is loaded via AJAX. The data is not hardcoded into what your browser renders.

You should think of a different way to accomplish your goals. If you tell us a little more about what you're trying to do, we can probably help you find an alternate method.

Paul McMillan
(Just as a side-topic, most FB interfaces will gracefully degrade if you visit without javascript, so an AJAx-dependency is not as bit a contributing factor.) Agreed that scraping FB for content is not the best way to do it, and that using an alternate method would be preferable (and less likely to upset the FB admins).
Lucanos
A: 

I need to create 2 application. I want to parse the html code to get some information from one to the other. I don't want to duplicate or take the facebook code. I just want to make a "view source" (like IE or firefox) and put it on a file, without ask my users. When my user is logged in my first application, i just want to is is credential to get the other content.

Damien
Just to clarify your usage here: You want your users to execute the above PHP code and then extract details from the response, without their knowledge? Well, for one, the PHP call through `file_get_contents()` will be going from your server, rather than from their computer, and so all kinds of authentication issues/safeguards will prevent that. Then there are the questions about why you would want to do this, user privacy expectations and TOS's for all involved services. I would recommend you review your plans here...
Lucanos