Sprawa jest dość prosta. Należy skorzystać z Facebook API
Kod w php:
function iworks_get_fb_likes( $url ) { $query = sprintf( "select total_count from link_stat where url='%s'", $url ); $call = "https://api.facebook.com/method/fql.query?query=" . rawurlencode($query) . "&format=json"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $call); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); curl_close($ch); $fb = json_decode($output); if ( is_array( $fb ) ) { $fb = reset( $fb ); if ( isset( $fb->total_count ) ) { return $fb->total_count; } } return 0; } |