Получение голосов!
Получение голосов!
пожалуйста напишите php скрипт для снятия голосов со счета пользователя. все обыскал ничего не работает. хостинг с php и curl есть! и на вкладке платежи нет никакого ключа. все ключи только в настройках редактирования, но не в платежах!
Re: Получение голосов!
http://flapps.ru/forum/topic437.html
Там где написано "Ключ из платежей " равносильно защищенному ключу
Там где написано "Ключ из платежей " равносильно защищенному ключу
Re: Получение голосов!
я делаю как там пишут и голос на личный счет переводится а не на вкладку платежи! как сделать чтобы он сразу туда попадал????????????????
Re: Получение голосов!
1)Мб не включены платежи
2)Мб хостинг не хорошии
3)Мб нету на хостинг рядом с тем php файла VkApi.class.php
Фаил должен называться VkApi.class и иметь расширения php
Если это не помогло ,то посмотри что пишет чарлез
http://flapps.ru/forum/topic881.html
2)Мб хостинг не хорошии
3)Мб нету на хостинг рядом с тем php файла VkApi.class.php
Код: Выделить всё
<?/** * Класс обертка, для VkApi. Здесь описываются методы для запросов. * * @package VkApi * @author Michael Elovskih <wronglink@gmail.com> * used by flapps.ru */class VkApiNode{ /** * Конструктор класса. Принимает обязательные $api_id (Id приложения) Рё * $secret (секретный РєРѕРґ приложения). * * @param integer $api_id Id приложения. * @param string $secret Секретный РєРѕРґ приложения. * @param string $format Формат ответа (XML или JSON). РџРѕ умолчанию, 'XML'. * @param string $version Версия API. РџРѕ умолчанию, '2.0'. * @param string $server_url Адрес сервера API. РџРѕ умолчанию 'http://api.vkontakte.ru/api.php?'. * @param mixed $timestamp Timestamp сервера. Если РЅРµ задано - берется системное. * @param mixed $random Случайное значение. Если РЅРµ задано - задается через rand(). */ public function __construct ($api_id, $secret, $format = 'XML', $version = '2.0', $server_url = 'http://api.vkontakte.ru/api.php?', $timestamp = false, $random = false) { $this->api_id = $api_id; $this->method = $method; $this->secret = $secret; $this->format = $format; $this->version = $version; $this->server_url = $server_url; $this->timestamp = $timestamp ? $timestamp : time(); $this->random = $random ? $random : rand(); } /** * Отправляет уведомления пользователям. Для того, чтобы пользователь получил уведомление * необходимо, чтобы Сѓ него было разрешено получение уведомлений РІ настройках. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.sendNotification * * @param mixed $uids Id пользователей (массив РґРѕ 100 чисел или число). * @param string $message Текст сообщения. * * @return string Строка запроса. */ public function sendNotification ($uids, $message) { $api = new VkApi($this->api_id, 'secure.sendNotification', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uids', join(',', $uids)); $api->addParameter('message', $message); return $api->getQuery(); } /** * Сохраняет строку статуса приложения для последующего вывода РІ * общем СЃРїРёСЃРєРµ приложений РЅР° странице пользоваетеля. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.saveAppStatus * * @param integer $uid Id пользователя. * @param string $status Текст статуса. Строка РґРѕ 32 символов. * * @return string Строка запроса. */ public function saveAppStatus ($uid, $status) { $api = new VkApi($this->api_id, 'secure.saveAppStatus', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uid', $uid); $api->addParameter('status', $status); return $api->getQuery(); } // added by flapps.ru public function getAppStatus ($uid) { $api = new VkApi($this->api_id, 'secure.getAppStatus', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uid', $uid); return $api->getQuery(); } /** * Возвращает платежный баланс приложения. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.getAppBalance * * @return string Строка запроса. */ public function getAppBalance () { $api = new VkApi($this->api_id, 'secure.getAppBalance', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); return $api->getQuery(); } /** * Возвращает баланс пользователя РЅР° счету приложения. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.getBalance * * @param integer $uid Id пользователя. * * @return string Строка запроса. */ public function getBalance ($uid) { $api = new VkApi($this->api_id, 'secure.getBalance', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uid', $uid); return $api->getQuery(); } /** * Переводит голоса СЃРѕ счета приложения РЅР° счет пользователя. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.addVotes * * @param integer $uid Id пользователя. * @param integer $votes Количество голосов (РІ 100 долях). * * @return string Строка запроса. */ public function addVotes ($uid, $votes) { $api = new VkApi($this->api_id, 'secure.addVotes', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uid', $uid); $api->addParameter('votes', $votes); return $api->getQuery(); } /** * Списывает голоса СЃРѕ счета пользователя РЅР° счет приложения. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.withdrawVotes * * @param integer $uid Id пользователя. * @param integer $votes Количество голосов (РІ 100 долях). * * @return string Строка запроса. */ public function withdrawVotes ($uid, $votes) { $api = new VkApi($this->api_id, 'secure.withdrawVotes', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uid', $uid); $api->addParameter('votes', $votes); return $api->getQuery(); } /** * Переводит голоса СЃРѕ счета РѕРґРЅРѕРіРѕ пользователя РЅР° счет РґСЂСѓРіРѕРіРѕ РІ рамках приложения. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.transferVotes * * @param integer $uid_from Id пользователя, РѕС‚ которого переводятся голоса. * @param integer $uid_to Id пользователя, которому переводятся голоса. * @param integer $votes Количество голосов (РІ 100 долях). * * @return string Строка запроса. */ public function transferVotes ($uid_from, $uid_to, $votes) { $api = new VkApi($this->api_id, 'secure.transferVotes', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uid_from', $uid_from); $api->addParameter('uid_to', $uid_to); $api->addParameter('votes', $votes); return $api->getQuery(); } /** * Возвращает историю транзакций внутри приложения. * @see http://vkontakte.ru/pages.php?o=-1&p=secure.getTransactionsHistory * * @param integer $type РўРёРї возвращаемых транзакций. * 0 – РІСЃРµ транзакции, 1 – транзакции типа "пользователь в†’ приложение", * 2 – транзакции типа "приложение в†’ пользователь", 3 – транзакции типа "пользователь в†’ пользователь" * @param integer $uid_from Фильтр РїРѕ Id пользователя, СЃ баланса которого снимались голоса. * @param integer $uid_to Фильтр РїРѕ Id пользователя, РЅР° баланс которого начислялись голоса. * @param integer $date_from Фильтр РїРѕ дате начала. Задается РІ РІРёРґРµ UNIX-time. * @param integer $date_to фильтр РїРѕ дате конца. Задается РІ РІРёРґРµ UNIX-time. * @param integer $limit Количество возвращаемых записей. РџРѕ умолчанию 1000. * * @return string Строка запроса. */ public function getTransactionsHistory ($type = 0, $uid_from = null, $uid_to = null, $date_from = null, $date_to = null, $limit = 1000) { $api = new VkApi($this->api_id, 'secure.getTransactionsHistory', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); if($type) $api->addParameter('type', $type); if($uid_from) $api->addParameter('uid_from', $uid_from); if($uid_to) $api->addParameter('uid_to', $uid_to); if($date_from) $api->addParameter('date_from', $date_from); if($date_to) $api->addParameter('date_to', $date_to); if($limit) $api->addParameter('limit', $limit); return $api->getQuery(); } // added by flapps.ru public function addRating ($uid, $rate, $message = null) { $api = new VkApi($this->api_id, 'secure.addRating', $this->secret, $this->format, $this->version, $this->server_url, $this->timestamp, $this->random); $api->addParameter('uid', $uid); $api->addParameter('rate', $rate); if($message) $api->addParameter('message', $message); return $api->getQuery(); } } /** * Класс VkApi. Для каждого запроса создается экземпляр данного класса, * задаются метод API Рё параметры запроса Рё вызывается getQuery метод. * * @package VkApi * @author Michael Elovskih <wronglink@gmail.com> */class VkApi{ /** * Конструктор класса. * * @param integer $api_id Id приложения. * @param string $method Название метода API. * @param string $secret Секретный РєРѕРґ приложения. * @param string $format Формат ответа (XML или JSON). * @param string $version Версия API. * @param string $server_url Адрес сервера API. * @param mixed $timestamp Timestamp сервера. * @param mixed $random Случайное значение. */ public function __construct ($api_id, $method, $secret, $format, $version, $server_url, $timestamp, $random) { $this->api_id = $api_id; $this->method = $method; $this->secret = $secret; $this->format = $format; $this->version = $version; $this->server_url = $server_url; $this->timestamp = $timestamp; $this->random = $random; $this->parameters = array(); $this->parameters[] = array('name' => 'api_id', 'value' => $this->api_id); $this->parameters[] = array('name' => 'method', 'value' => $this->method); $this->parameters[] = array('name' => 'format', 'value' => $this->format); $this->parameters[] = array('name' => 'v', 'value' => $this->version); $this->parameters[] = array('name' => 'timestamp', 'value' => $this->timestamp); $this->parameters[] = array('name' => 'random', 'value' => $this->random); } /** * __toString метод класса. * * @return string Строка запроса. */ public function __toString () { $this->parameters[] = array('name' => 'sig', 'value' => $this->getSig()); foreach($this->parameters as $p) $query[] = $p['name'].'='.rawurlencode($p['value']); return $this->server_url . join('&', $query); } /** * Добавляет параметр запроса. * * @param string $p_name Название параметра * @param string $p_value Значение параметра */ public function addParameter ($p_name, $p_value) { $this->parameters[] = array('name' => $p_name, 'value' => $p_value); } /** * Возвращает строку запроса. * * @return string Строка запроса. */ public function getQuery () { return $this->__toString(); } /** * Считает Sig-РїРѕРґРїРёСЃСЊ приложения. * * @return string Sig-РїРѕРґРїРёСЃСЊ приложения. */ private function getSig () { sort($this->parameters); foreach($this->parameters as $p) $sigStr .= join('=',$p); return md5($sigStr . $this->secret); }} ?> Если это не помогло ,то посмотри что пишет чарлез
http://flapps.ru/forum/topic881.html
Re: Получение голосов!
crossdomain.xml
Re: Получение голосов!
нет у мня это все есть!
php код можете написать? мне только он нужен.
php код можете написать? мне только он нужен.
Re: Получение голосов!
VkApi.class ?Я уже писал постом выше
Re: Получение голосов!
нет не VkApi, а код php к которому из флешки обращаемся!!! код, который рядом с вкапи в одном каталоге должен лежать
Re: Получение голосов!
Код: Выделить всё
<?php// http://flapps.ru/forum/ - форум о создании приложений В Контакте require('VkApi.class.php'); $UserID = $_POST['UserID']; $auth_key = $_POST['auth_key'];$app_id = 'ID приложения';$api_secret = 'Защищенный ключ'; $real_key = md5($app_id."_".$UserID."_".$api_secret); if ($auth_key == $real_key){ function get_url($query) {$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $query);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_TIMEOUT, 10);return curl_exec($ch);curl_close($ch);}$api = new VkApiNode($app_id, $api_secret);$query = $api->getBalance($UserID);$user_balance = new SimpleXMLElement(get_url($query)); if ($user_balance->balance >=100) {get_url($query = $api->withdrawVotes($UserID, 100));}}?>Re: Получение голосов!
этот код не рабочий!
