1

图片页面: http://vk.com/id98429809?z= photo98429809_299166823%2Falbum98429809_0%2Frev

业主编号: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?

请告诉我错误在哪里?

4

1 回答 1

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

于 2013-06-28T12:08:08.890 回答