PrateekSaluja
PrateekSaluja

Reputation: 14926

Posting Updates to Facebook Fan Pages using Graph API?

I want to post on face book page using Graph API.The code will be in Asp.Net with c#.Just need to know how can i post to face book page(not account).I am able to send into account,now want to post in page.I refereed this link Graph API

please help me to solve the issue.

Thanks in advance.

Upvotes: 2

Views: 800

Answers (1)

Soufiane Hassou
Soufiane Hassou

Reputation: 17750

I have a working code in PHP, hopefully, you can make it work for c#.

Basically, I'm using php-curl for the url feed of the fan page. You should be able to find a c# wrapper/binding for curl, maybe this libcurl for .NET

$url = "https://graph.facebook.com/PAGE_ID/feed";

$attachment =  array(

          'access_token' => 'YOUR_ACCESS_TOKEN',
          'message' => 'your message',
                'name' => "your title",
                'link' => "your link",
                'description' => "your description",

        );

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);

$result= curl_exec($ch);
curl_close ($ch);

Upvotes: 1

Related Questions