To collect statistics from a shared URL on Facebook in PHP, I'm making use of cURL to query the following URI:
// URL para submeter
$pageUrl = 'http://www.example.com/my-new-article-is-neat';
// URI a consultar
$uri = 'https://graph.facebook.com/fql?q=';
$uri.= urlencode("SELECT like_count, total_count, share_count, click_count, comment_count FROM link_stat WHERE url = \"{$pageUrl}\"");
/* cURL it
*/
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $uri
));
$resp = curl_exec($curl);
curl_close($curl);
Where do we get:
{
"data": [
{
"like_count": 0,
"total_count": 0,
"share_count": 0,
"click_count": 0,
"comment_count": 0
}
]
}
Then we can use the result as follows:
$respObj = json_decode($resp);
var_dump($respObj->data[0]->total_count); // int(0)
Question
How can I perform the same Python operation?