私はこの機能を持っています:
function get_vk($url) {
$str = file_get_contents("http://vk.com/share.php?act=count&index=1&url=" . $url);
if (!$str) return 0;
return preg_match('/^VK.Share.count\((\d+),\s+(\d+)\);$/i', $rq, $i) ? (int) $i[2] : 0;
}
ただし、この関数$str
は NULL であるため、常に 0 を返します。しかし、このリンクを張るだけなら
https://vk.com/share.php?act=count&index=1&url=http://stackoverflow.com
ブラウザに戻りVK.Share.count(1, 43);
ますどこに問題がありますか?