Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vkApi_getserver($api_key) {
- $curl = curl_init('https://api.vk.com/method/appWidgets.getGroupImageUploadServer');
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, array('image_type' => '510x128', 'access_token' => $api_key, 'v' => '5.68'));
- $json = curl_exec($curl);
- curl_close($curl);
- return json_decode($json, true);
- }
- function vkApi_upload($url, $file_name) {
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, array('file' => new CURLfile($file_name)));
- $json = curl_exec($curl);
- curl_close($curl);
- return json_decode($json, true);
- }
- function vkApi_save($hash, $image, $api_key) {
- $curl = curl_init('https://api.vk.com/method/appWidgets.saveGroupImage');
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, array('hash' => $hash, 'image' => $image, 'access_token' => $api_key, 'v' => '5.68'));
- $json = curl_exec($curl);
- curl_close($curl);
- return json_decode($json, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement