0

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

STech
  • 69
  • 1
  • 10

2 Answers2

2

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?

Community
  • 1
  • 1
luschn
  • 68,448
  • 8
  • 104
  • 118
1

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();
lars.schwarz
  • 1,246
  • 1
  • 8
  • 12
  • Thank you for your reply. At the moment I can't use PHP. I will be very thankful if your translate it in https://graph.facebook.com/page_id/setting?..... like API call. – STech Sep 30 '15 at 12:24
  • 1
    It's a POST request, so you can't use a simple GET URL request. For CURL the requests looks like this: curl -i -X POST \ -d "debug=all" \ -d "option=%7B%22COUNTRY_RESTRICTIONS%22%20%3A%20%7B%22restriction_type%22%3A%22blacklist%22%2C%20%22countries%22%3A%5B%22PL%22%2C%20%22FR%22%5D%7D%7D" \ -d "access_token=YOUR_ACCESS_TOKEN" \ "https://graph.facebook.com/v2.4/your_page_id/settings" – lars.schwarz Sep 30 '15 at 12:37
  • Thank you very much for your guidance. Can I use simple PHP curl call with page access token to achieve this goal? If yes, please transate it. I can't use Facebook PHP API because I came to know after I post this question. – STech Sep 30 '15 at 13:08
  • Thanks again for your reply. I solved it. I will use your PHP SDK solution when I need it. @lars.schwarz – STech Sep 30 '15 at 18:56