六派数据-单位换算
  • ID

    36

  • 收藏

    0

  • 使用

    0

单位换算

长度、面积、体积、质量、温度、压力、功率、力、功/能/热、时间、速度、光照、角度、密度、数据存储等单位换算接口,提供同类单位相互转换、单个单位量对应的同类单位的数量、所有单位清单,方便调用、换算。
免费会员100次/天 白银会员600次/天 钻石会员15万次/日
免费 (根据会员等级不同,每日可调用次数不同,了解各会员权益>>
  • 单位换算
  • 单个单位
  • 所有单位

基本信息

  • 接口地址: http://open.liupai.net/unitconvert/convert
  • 支持格式: JSON,JSONP
  • 请求方法: GET POST
  • 请求示例: http://open.liupai.net/unitconvert/convert?appkey=yourappsecret

请求参数 API在线测试

参数名称 类型 必填 说明
from string 要换算的单位
to string 换算后的单位
amount int 数量

返回参数

参数名称 类型   说明
from string   要换算的单位
to string   换算后的单位
fromename string   要换算的单位英文名
toename string   换算后的单位英文名
fromsymbol string   要换算的单位符号
tosymbol string   换算后的单位符号
rate string   换算比例
camount string   换算后的额度

请求代码 查看代码

  • PHP
  • JAVA
  • Python
require_once("curl.func.php");

$method = "POST";
$url = "http://open.liupai.net/unitconvert/convert";
$headers = NULL;
$params = array(  
    "appkey" => "yourappsecret",
    "from" => "千米",
    "to" => "米",
    "amount" => "5"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
    $body = json_decode($result["body"], TRUE);
    $status_code = $body["status"];
    if ($status_code == "200") { 
        var_dump($body["result"]);
    }else
        var_dump($body); 
}else  
    echo "发送请求失败";

JSON返回示例

{
    "status": 200,
    "msg": "OK",
    "result": {
        "from": "微米",
        "to": "纳米",
        "fromename": "micrometer",
        "toename": "nanometer",
        "fromsymbol": "um",
        "tosymbol": "nm",
        "rate": 1000,
        "camount": 5000
    }
}

    数据信息

  • 今日调用: 15,408  次
  • 客服电话: 010-8639-9970
  • 客服邮箱: kf@ksmsoft.net
  • 售前客服:
  • 售后技术:

单位换算问答专区

问答专区

相关资讯

其他推荐