Documentación API
URL
https://mrpopular.net/api/v2.php
Solicitud
POST / GET / JSON
Respuesta
JSON
Autorización
username
password
Averiguar balance
action = balance
currency = EUR
{"balance":123.456}
Obtener estado del balance
action = status
order = (pedido ID)
{"order":{"status":"2","completed":"0","quantity":"250","date":"2018-09-27 17:34:49"}}
Obtener lista de servicios
action = service
{"service":{"1":{"social_network":"Facebook","service":"page likes","quality":"medium quality","id":"1","price":0.0149,"currency":"USD","min":"100"},...}}
Descripción del esrado del pedido
0 : pendiente/procesamiento
1 : procesamiento
2 : completado
3 : error
4 : error
5 : devuelto
devuelto
action = order
service = (servicio ID)
quantity = cantidad
option
comment
link = enlace
{"order":"142058"}
Errores
{"errorcode":1} USERNAME o PASSWORD no está indicado
{"errorcode":2} ACTION no está indicada
{"errorcode":3} CURRENCY no está disponible
{"errorcode":4} ORDER no está disponible
{"errorcode":5} ORDER incorrecto
{"errorcode":6} SERVICE no está disponible
{"errorcode":7} QUANTITY no está disponible
{"errorcode":8} LINK no está disponible
{"errorcode":9} Fondos insuficientes en el balance
{"errorcode":10} Fondos insuficientes en el balance
Ejemplos del código php
class Api { //configuración public $api_url = 'https://mrpopular.net/api/v2.php'; // API URL public $username = ''; //tu username public $password = ''; //tu password public $currency = 'EUR'; public function order($data) { // añadir pedido $post = array_merge(array( 'username' => $this->username, 'password' => $this->password, 'action' => 'order' ), $data); return json_decode($this->connect($post)); } public function status($order) { // obtener estado de pedido return json_decode($this->connect(array( 'username' => $this->username, 'password' => $this->password, 'action' => 'status', 'order' => $order ))); } public function service() { // obtener lista de servicios return json_decode($this->connect(array( 'username' => $this->username, 'password' => $this->password, 'action' => 'service', ))); } public function balance() { // obtener balance return json_decode($this->connect(array( 'username' => $this->username, 'password' => $this->password, 'action' => 'balance', ))); } function connect($post) { $_post = Array(); if (is_array($post)) { foreach ($post as $name => $value) { $_post[] = $name.'='.urlencode($value); } } $ch = curl_init($this->api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); if (is_array($post)) { curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_post)); } curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'); $result = curl_exec($ch); if (curl_errno($ch) != 0 && empty($result)) { $result = false; } curl_close($ch); return $result; } } //empezar API $api = new Api(); //balance revisar /*$balance = $api->balance(); print_r($balance);*/ //nuevo pedido /*$order = $api->order(array( 'service' => 462, 'quantity' => $qnty, 'link' => $src )); print_r($order);*/ //nuevo pedido /*$status = $api->status(12232); print_r($status);*/ //obtener lista de servicios /*$service = $api->service(); print_r($service);*/