照片页面: http://vk.com/id98429809?z=photo98429809_299166823%2Falbum98429809_0%2Frev
所有者ID:3734832
我正在使用此代码:
$res = file_get_contents('https://api.vk.com/method/likes.getList?type=photo&owner_id='3734832'&page_id='98429809'&page_url=http://vk.com/id98429809?z=photo98429809_299166823%2Falbum98429809_0%2Frev');
$resp = json_decode($res, true);
echo 'Count Likes: '.$resp['response']['count'];
但我遇到了错误:
{"error":{"error_code":100,"error_msg":"One of the parameters specified was missing or invalid: item_id is undefined","request_params":[{"key":"oauth","value":"1"},{"key":"method","value":"likes.getList"},{"key":"type","value":"photo"},{"key":"owner_id","value":"3734832"},{"key":"page_id","value":"98429809"},{"key":"page_url","value":"http:\/\/vk.com\/id98429809?z=photo98429809_299166823\/album98429809_0\/rev"}]}}
如何获取喜欢这张照片的所有用户ID?
请告诉我,错误在哪里?
答案 0 :(得分:4)
1)为了获得除小部件之外的所有项目的喜欢,您应该使用item_id
参数而不是page_url
2)您输入了错误的owner_id
正确的API请求是:
https://api.vk.com/method/likes.getList?type=photo&owner_id=98429809&item_id=299166823