function vkxp_query in VK CrossPoster 6.2
Same name and namespace in other branches
- 6.3 vkxp.module \vkxp_query()
- 6 vkxp.module \vkxp_query()
- 7.2 vkxp.module \vkxp_query()
- 7 vkxp.module \vkxp_query()
Function makes query to vk.com. Allows using hook_vkxp_query_alter() for altering query params.
3 calls to vkxp_query()
- vkxp_admin_main_settings in ./
vkxp.admin.inc - Page callback. Return form with main settings.
- _vkxp_get_upload_server in ./
vkxp.module - Makes http query to api server to get upload uri.
- _vkxp_upload_images in ./
vkxp.module - Upload and save images to vk server.
File
- ./
vkxp.module, line 217
Code
function vkxp_query($method, $params, $request_url = 'https://api.vkontakte.ru/method/') {
// Collect params for request.
$query = array();
$query['method'] = $method;
$query['params'] = $params;
$query['request_url'] = $request_url;
drupal_alter('vkxp_query', $query);
// cURL request.
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $query['request_url'] . $query['method']);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $query['params']);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return json_decode($result, TRUE);
}