Using OpenGraph with PHP (cUrl requests for actions)

When I press the “get code” link near the action, that’s what I get:

curl -F ‘access_token=***’ \
 -F ‘article=http://example.com’ \
    ‘https://graph.facebook.com/me/yellowheart:read’

(There’s an actual access token of course).

sing the PHP SDK you would use the api method.

$facebook = new Facebook($config);

$facebook->api(‘https://graph.facebook.com/me/yellowheart:read?  
                article=http://example.com”,’POST‘);

You could also do a raw request

$myurl = ‘https://graph.facebook.com/me/yellowheart:read?
          article=http://example.com&your_access_token&method=post’;

$result = file_get_contents($myurl);

facebook Uncaught CurlException

If you’re on windows system you can fix it adding this, define CA path:

CURLOPT_CAINFO => ‘C:\xampp\htdocs\myFacebook\fb_ca_chain_bundle.crt’

public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT        => 60,
CURLOPT_USERAGENT      => ‘facebook-php-2.0′,
//CURLOPT_CAINFO => ‘C:\xampp\htdocs\myFacebook\fb_ca_chain_bundle.crt’,
);

If you’re not, try this one:

$opts[CURLOPT_SSL_VERIFYPEER] = false;
$opts[CURLOPT_SSL_VERIFYHOST] = 2;

监控网站连接,流量等情况

http://www.jiankongbao.com/labs/http