Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $json_string = file_get_contents('http://api.vk.com/method/wall.get?v=5.7&domain=verstka_html');
- $json = json_decode($json_string, true);
- $all_posts = $json['response'];
- $photoUrl = array();
- foreach ($all_posts['items'] as $post) {
- if (!empty($post['attachments'])) {
- foreach ($post['attachments'] as $postAttachment) {
- if ($postAttachment['type'] == 'photo') {
- $photoUrl[] = $postAttachment['photo'];
- }
- }
- }
- }
- foreach ($photoUrl as $item) {
- if (!empty($item['photo_807'])) {
- return $item['photo_807'];
- }
- }
- return '';
Advertisement
Add Comment
Please, Sign In to add comment