0

I have a similar issue to this question: how to get members' info by using group id in facebook?

However I'm not using the Facebook graph API.
Is it possible to get data, i.e. member names, assuming that I have the group url only? To be more precise, I am able to login using PHP, by cURL library at moment, but I would know if a way for this task exists.

This is my code:

$login_email = 'email';
$login_pass = 'password';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://www.facebook.com/login.php');
curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&login=Login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_setopt($ch, CURLOPT_REFERER, "http://www.facebook.com");
curl_setopt($ch, CURLOPT_COOKIESESSION, false);
$login_page = curl_exec($ch) or die(curl_error($ch));

$group = file_get_contents('https://www.facebook.com/groups/****/');
echo $group;

This show me the page http://www.facebook.com instead of group page.
However, if I do
echo $login_page
it return the home page of my account(after login).
Thank you!

Community
  • 1
  • 1
alx.r89
  • 48
  • 1
  • 9
  • 1
    Can you do it manually by logging in? If yes then you can do it using `cURL`. What is your question exactly? What do you have a problem with? – Jakub Kania Sep 14 '14 at 11:15
  • I have tried the 'file_get_contents()' to get the page of the group, after login, but it doesn't work. The login is successfull – alx.r89 Sep 14 '14 at 11:32
  • What file? What is your code? How it doesn't work? Do you get a syntax error? Is the file empty? We can't help you if you won't describe your problem well. – Jakub Kania Sep 14 '14 at 11:34
  • Scraping is against Facebook’s TOS. You should make do with the information available to you via API. – CBroe Sep 14 '14 at 16:25
  • I have added more details in the post. @CBroe I hear about access token related to the particular group/page, but I'm not the administrator of group. Is it possible get data in this case? – alx.r89 Sep 14 '14 at 18:40
  • Are you at least a member of the group? – CBroe Sep 14 '14 at 18:55

0 Answers0