Y
Y
yischyk2019-10-13 13:44:02
PHP
yischyk, 2019-10-13 13:44:02

Group_id not accepted in photos.getWallUploadServer and photos.saveWallPhoto?

there is a code

$tokens = 'a021ef90aec22f2bc8cede0161c128fbdfa78ha7e9a20a72247857f5f22bc2518d3aab40885a4dcd9b405049';
        $group_id = '185113384'; //без минуса
        $album = '263520595';
        $imgName = $_SERVER['DOCUMENT_ROOT'].'/userapi/'.$image_res;

        $vk = new Vk($tokens);

        $upload_server = $vk->request('photos.getWallUploadServer', [
            'group_id' => $group_id,
        ]);

        $upload_vk = $vk->uploadFile($upload_server['upload_url'], $imgName);

        $i = $vk->request('photos.saveWallPhoto', [
            'server' => $upload_vk['server'],
            'photos_list' => $upload_vk['photos_list'],
            'aid' => $upload_vk['aid'],
            'hash' => $upload_vk['hash'],
            
            'photo' => $upload_vk['photo'],
            'group_id' => $group_id,
        ]);
        unlink($imgName);


          $photo_id   =  $i[0]['id'];
          $owner_id   =  $i[0]['owner_id'];
          $text_post  =  $_POST['tr'];
          $prc        =  $_POST['option'];
          $repost     =  $_POST['repost'];
          $gid = $_GET['id'];
          $photo_post = $owner_id.'_'.$photo_id;
          
          var_dump($i);

I pass the group_id parameter, but for some reason the answer comes to me not for the group, but for my VK page, here:
array(1) { [0]=> array(7) { ["id"]=> int(457250833) ["album_id"]=> int(-14) ["owner_id"]=> int(465697626) ["sizes"]=> array(9) { [0]=> array(4) { ["type"]=> string(1) "s" ["url"]=> .............

as a result, I can not get the normal address of the photo.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question