Hello
i have some trouble with my code :
It's working if i use that :
FB.api('https://graph.facebook.com/','post', {
id: 'http://example.fr/',
scrape: true,
access_token:'xxxxx|xxxxxx'
}, function(response) {
console.log('rescrape!',response);
});
For secure token, i want to use serveur side, if i use this code ( with ajax to send url ) :
class FacebookDebugger {
public function reload($url)
{
$token = 'xxxxxxxxxxxxxxx|xxxxxxxxxxx';
$graph = 'https://graph.facebook.com/';
$post = 'id='.urlencode($url).'&scrape=true&access_token='.$token;
return $this->send_post($graph, $post);
}
private function send_post($url, $post)
{
$r = curl_init();
curl_setopt($r, CURLOPT_URL, $url);
curl_setopt($r, CURLOPT_POST, 1);
curl_setopt($r, CURLOPT_POSTFIELDS, $post);
curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($r, CURLOPT_CONNECTTIMEOUT, 5);
$data = curl_exec($r);
curl_close($r);
return $data;
}
}
$fb = new FacebookDebugger();
$fb = $fb->reload($url)
It's not working. In respons ajax
$fb = new FacebookDebugger();
$fbrepons = $fb->reload($url)
echo var_dump($fbrepons);
I have " boolean false".
An idea ?
Thanks you for your help