Help! How to access Facebook page source with php?

General discussions related to php

Moderators: macek, egami, gesf

stw123456789
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Nov 14, 2012 4:38 am

Help! How to access Facebook page source with php?

Postby stw123456789 » Wed Nov 14, 2012 4:46 am

Hello!

Does anyone know how i can access Facebook page sources with php using WAMP Server? I tried the following lines but they kept bringing me to some Facebook page telling me to "Update Your Browser".

$hey = fopen("http://facebook.com/TheStraitsTimes/posts/439530616108591", "r");
while (!feof($hey))
{
$line = fgets($hey);
echo $line;
}

However, i know its not a browser problem because i can access Facebook normally on my computer and the exact same lines work when i use an online hosting service.

Please help me!! Thanks in advance!

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Help! How to access Facebook page source with php?

Postby egami » Wed Nov 14, 2012 4:11 pm

ahh, young grasshopper... Facebook requires... authentication.

stw123456789
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Nov 14, 2012 4:38 am

Re: Help! How to access Facebook page source with php?

Postby stw123456789 » Wed Nov 14, 2012 7:03 pm

Oh I don't think its the authentication problem. But i figured it wasn't a good idea after re-reading the FB TOS. Thanks anyway!

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Help! How to access Facebook page source with php?

Postby seandisanti » Thu Nov 15, 2012 8:53 am

You know you can write facebook apps too though, right? just sign up as a developer and start using their api to do what you wanted to scrape


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron