A
A
Alexey Shavrak2013-11-02 23:37:38
PHP
Alexey Shavrak, 2013-11-02 23:37:38

Search for audio recordings through the Vkontakte API

I can't do a search in vk on the site. I work through the vkapi class that I downloaded from the off site.

When I try to search, I get an error:

public error_code => string(2) "11"
public error_msg => string(72) "In test mode application should be disabled or user should be authorized"


How to make a working search, without any authorizations?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Plotnikov, 2013-11-03
@alekseyshavrak

For your task, you need to make an application in VK.
require 'vkapi.class.php'; // Include the class
$api_id = '0123456789'; // ID of your application
$vk_id = '0123456789'; // ID of your account
$VK = new vkapi($api_id, $vk_id); // Call the constructor
$track_name = "Audio track name";
$resp = $VK->api('audio.search',array('q'=>$track_name,'count'=>'1'));
//Save to our server
foreach($resp->audio as $key => $val) {
copy($val->url, 'mp3/'.$track_name.'.mp3');
}
All searches will be done on your behalf and application. The music parser did this himself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question