Skip to content

Instantly share code, notes, and snippets.

@sergiks
Last active December 3, 2017 09:51
Show Gist options
  • Save sergiks/838f85816c640a1bfc99ea48bf02a169 to your computer and use it in GitHub Desktop.
Save sergiks/838f85816c640a1bfc99ea48bf02a169 to your computer and use it in GitHub Desktop.
calling VKScript
<?php
$params = array(
'code' => " говнокод here ",
'access_token' => $token,
'v' => 5.64,
);
$url = 'https://api.vk.com/method/execute'. '?' . http_build_query( $params);
$ch = curl_init();
curl_setopt_array( $ch, array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_FOLLOWLOCATION => FALSE,
CURLOPT_HEADER => FALSE,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => array('Accept-Language: ru,en-us'),
CURLOPT_URL => $url,
CURLOPT_SSL_VERIFYPEER => FALSE,
));
if( !$response = curl_exec( $ch)){
Log::error( 'error ...', array( 'error'=>curl_error($ch)));
return;
}
curl_close( $ch);
$result = json_decode($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment