Thursday, 15 April 2010

php - How to send a facebook notification to a user using curl without facebook SDK -



php - How to send a facebook notification to a user using curl without facebook SDK -

i tried next following output facebook since requires post.

$ch = curl_init('https://graph.facebook.com/appuserid/notifications?access_token=*****&href=index.php&template=test'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch,curlopt_post, 1); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_ssl_verifyhost, 0); $response = curl_exec($ch); var_dump($response); var_dump(json_decode($response));

then following, might doing wrong?

string '<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" id="facebook"> <head> <title>facebook | error</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="cache-control" content="no-cache" /> <meta name="robots" content="noindex,nofollow" /> <style type="text/css"> html, body { margin: '... (length=2131) null

you can quite using native facebook php-sdk:

https://developers.facebook.com/docs/php/gettingstarted/4.0.0

here's api method documentation sending notifications: https://developers.facebook.com/docs/graph-api/reference/v2.1/user/notifications

example usage php-sdk:

/* php sdk v4.0.0 */ /* create api phone call */ $request = new facebookrequest( $session, 'post', '/{user-id}/notifications', array ( 'href' => '/testurl?param1=value1', 'template' => 'this test message', ) ); $response = $request->execute(); $graphobject = $response->getgraphobject(); /* handle result */

php facebook http facebook-graph-api curl

No comments:

Post a Comment