API文档
链接
https://mrpopular.net/api/v2.php
查询
POST / GET / JSON
回答
JSON
登录
username
password
显示余额
action = balance
currency = CNY
{"balance":123.456}
查询订单状态
action = status
order = (订单号码)
{"order":{"status":"2","completed":"0","quantity":"250","date":"2018-09-27 17:34:49"}}
获取服务列表
action = service
{"service":{"1":{"social_network":"Facebook","service":"page likes","quality":"medium quality","id":"1","price":0.0149,"currency”:”CNY”,”min":"100"},...}}
订单状态
0 : 处理中,无统计信息
1 : 处理中,有统计信息
2 : 已处理完毕
3 : 处理错误
4 : 排队中
5 : 已退款
新订单
action = order
service = (服务ID)
quantity = 数量
option
comment
link = 链接
{"order":"142058"}
错误代码
{"errorcode":1} USERNAME 或 PASSWORD未发送
{"errorcode":2} ACTION未发送
{"errorcode":3} 已选货币不可用
{"errorcode":4} 未放送订单号码
{"errorcode":5} 订单号码不正确
{"errorcode":6} SERVICE 未发送
{"errorcode":7} 数量未发送
{"errorcode":8} 链接未发送
{"errorcode":9} 余额不足
{"errorcode":10} 数量小于最低量
php代码实例
class Api
{
//设置
public $api_url = 'https://mrpopular.net/api/v2.php'; // API URL
public $username = ''; //您的 username
public $password = ''; //您的 password
public $currency = 'CNY';
public function order($data) { // 添加订单
$post = array_merge(array(
'username' => $this->username,
'password' => $this->password,
'action' => 'order'
), $data);
return json_decode($this->connect($post));
}
public function status($order) { // 获取订单状态
return json_decode($this->connect(array(
'username' => $this->username,
'password' => $this->password,
'action' => 'status',
'order' => $order
)));
}
public function service() { // 获取服务列表
return json_decode($this->connect(array(
'username' => $this->username,
'password' => $this->password,
'action' => 'service',
)));
}
public function 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;
}
}
//启动API
$api = new Api();
//查看余额
/*$balance = $api->balance();
print_r($balance);*/
//新的订单
/*$order = $api->order(array(
'service' => 462,
'quantity' => $qnty,
'link' => $src
));
print_r($order);*/
//订单状态
/*$status = $api->status(12232);
print_r($status);*/
//订单状态
/*$service = $api->service();
print_r($service);*/