Answer the question
In order to leave comments, you need to log in
How to find out if a specific id has been liked or not?
Hello. I need to find out if I liked, for example, uid '1', on a photo.
Wrote this code:
$vkPhpSdk = new VkPhpSdk();
$result = $vkPhpSdk->api('likes.getList', array(
'type' => 'photo',
'owner_id' => '123456789',
'item_id' => '987654321',
'page_url' => '',
'filter' => 'likes',
'friends_only' => '0',
'extended' => '1',
'offset' => '1',
'count' => '1000',
'skip_own' => '0'
));
for($i = 0; $i < $result['response']['count']; $i++) {
if($result['response']['items'][$i]['uid'] == $user['uid']) {
echo 'like!';
break;
} else {
echo 'No like!';
break;
}
}
Answer the question
In order to leave comments, you need to log in
Why are you breaking the loop anyway?
You do not go beyond the first cycle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question