C
C
crack_user2021-08-01 14:37:04
PHP
crack_user, 2021-08-01 14:37:04

How to download voice from VK to the server?

Current code -

<?
if($data->object->message->attachments[0]->type == 'audio_message') {
    $owner_id = $data->object->message->attachments[0]->audio_message->owner_id;
    $fileName = "{$owner_id}.mp3";
    $urlFile = $data->object->message->attachments[0]->audio_message->link_mp3;
    file_put_contents('./'.$fileName, file_get_contents("{$urlFile}"));
    print_r($fileName);
    unlink($fileName);
}

Unfortunately, even the id does not write to the name, an empty .mp3 file is created, apparently it cannot find the path, but how to write it down correctly?
-
error -
Warning: file_get_contents(): Filename cannot be empty in /sites/dsada/photo.php on line 5
.mp3

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