You are here

function vkxp_query in VK CrossPoster 6

Same name and namespace in other branches
  1. 6.3 vkxp.module \vkxp_query()
  2. 6.2 vkxp.module \vkxp_query()
  3. 7.2 vkxp.module \vkxp_query()
  4. 7 vkxp.module \vkxp_query()

Function makes query to vkontakte.ru Allows using hook_vkxp_query_alter() for altering query params

4 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_post_to_wall in ./vkxp.module
Post node message with uploaded images to wall
_vkxp_upload_images in ./vkxp.module
Upload and save images to vk server

File

./vkxp.module, line 161

Code

function vkxp_query($method, $params, $request_url = 'https://api.vkontakte.ru/method/') {
  $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);
}