API Dokumentation
Link
https://mrpopular.net/api/v2.php
aAnfragen
POST / GET / JSON
Antworten
JSON
Autorisierung
username
password
Guthaben prüfen
action = balance
currency = EUR
{"balance":123.456}
Bestellstatus kontrollieren
action = status
order = (Bestellnummer)
{"order":{"status":"2","completed":"0","quantity":"250","date":"2018-09-27 17:34:49"}}
Dienstliste holen
action = service
{"service":{"1":{"social_network":"Facebook","service":"page likes","quality":"medium quality","id":"1","price":0.0149,"currency":"EUR","min":"100"},...}}
Bestellstatus
0 : Im Prozess, keine Statistik
1 : Im Prozess, es gibt Statistik
2 : fertig
3 : Fehler
4 : an der Reihe
5 : zurückgegeben
Neue Bestellung
action = order
service = (ID-Service)
quantity = Menge
option
comment
link = Link
{"order":"142058"}
Fehler
{"errorcode":1} USERNAME oder PASSWORD nicht gesendet
{"errorcode":2} ACTION nicht gesendet
{"errorcode":3} Die ausgewählte Währung ist nicht verfügbar
{"errorcode":4} Bestellnummer ist nicht gesendet
{"errorcode":5} falsche Bestellnummer
{"errorcode":6} SERVICE nicht gesendet
{"errorcode":7} Menge nicht gesendet
{"errorcode":8} Link nicht gesendet
{"errorcode":9} nicht genügend Guthaben
{"errorcode":10} Die Menge ist geringer als das Minimum
php Code-Beispiel
class Api
{
// Einstellungen
public $api_url = 'https://mrpopular.net/api/v2.php'; // Link für API
public $username = ''; //Ihr username
public $password = ''; //Ihr password
public $currency = 'EUR';
public function order($data) { // Bestellung hinzufügen
$post = array_merge(array(
'username' => $this->username,
'password' => $this->password,
'action' => 'order'
), $data);
return json_decode($this->connect($post));
}
public function status($order) { // Bestellstatus bekommen
return json_decode($this->connect(array(
'username' => $this->username,
'password' => $this->password,
'action' => 'status',
'order' => $order
)));
}
public function service() { // Dienstliste bekommen
return json_decode($this->connect(array(
'username' => $this->username,
'password' => $this->password,
'action' => 'service',
)));
}
public function balance() { // Guthaben kriegen
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;
}
}
// API starten
$api = new Api();
// Guthaben prüfen
/*$balance = $api->balance();
print_r($balance);*/
// neue Bestellung
/*$order = $api->order(array(
'service' => 462,
'quantity' => $qnty,
'link' => $src
));
print_r($order);*/
// Bestellstatus
/*$status = $api->status(12232);
print_r($status);*/
// Dienstliste
/*$service = $api->service();
print_r($service);*/