STech
STech

Reputation: 99

Facebook Fan Page API: How to call this API call using Facebook graph and PHP API

I have tried a lot but no luck. I want to call following API call using graph API like https://graph.facebook.com/page_id/settings?option={options}&access_token={page token} and Facebook PHP API.

curl -F 'method=post'
     -F 'option={"COUNTRY_RESTRICTIONS" : {"restriction_type":"blacklist", "countries":["PL", "FR"]}}'
     -F 'access_token={page_access_token}'
      https://graph.facebook.com/546349135390552/settings

You can find above API call here Facebook Fan Page API Documentation

Thank in advance

Upvotes: 0

Views: 457

Answers (2)

andyrandy
andyrandy

Reputation: 73984

You forgot the Page ID in the API call:

https://graph.facebook.com/page-id/settings...

Anyway, since you edited the question and that´s not the problem, here´s a tutorial about using PHP curl with POST: http://davidwalsh.name/curl-post

Another example from Stackoverflow: PHP + curl, HTTP POST sample code?

Upvotes: 2

lars.schwarz
lars.schwarz

Reputation: 1274

Complete call for PHP SDK would look like this:

$request = new FacebookRequest(
  $session,
  'POST',
  '/page_id/settings',
  array(
    'debug' => 'all',
    'option' => '{"COUNTRY_RESTRICTIONS" : {"restriction_type":"blacklist", "countries":["PL", "FR"]}}'
  )
);

$response = $request->execute();
$graphObject = $response->getGraphObject();

Upvotes: 1

Related Questions