简体   繁体   中英

facebook api login issue

Im trying to retrieve data from http://www.facebook.com/ajax/shares/view/?target_fbid=410558838979218&__a=1 I get mix of js and html with sharing information if I open this link through my browser, but if I use

$url = 'http://www.facebook.com/ajax/shares/view/?target_fbid=410558838979218&__a=1';
$html = file_get_contents($url);

I get

"Not Logged In","errorDescription":"Please log in to continue.","payload":{"_ dialog":{"title":{" _html":"Not Logged In"},"body":{"__html":"Please log in to continue.................

and etc I understand that i need to be logged in, i tried login through facebook api:

$config = array(
'appId' => '**********',
'secret' => '**********',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();

Im gettin user and etc, everything's okay, but retreiving share information fails anyways How can I "properly" login to solve this issue? Thanks

You're using the SDK initialisation code but trying to scrape facebook.com's web interface - these are not compatible things

You'd need to automate the login to facebook.com via your code as well and handle all the cookies if you want to scrape, buy doing so is explicitly against Facebook's TOS and could get you in legal trouble if you persist

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM