php slik转wav_silk转mp3(小程序音频silk转普通mp3接口)

接口请求地址

请求URL地址: http://silk2mp3.wlphp.com/api.php

上传音频

上传音频

支持.silk格式

1、视频大小尽量保持在10M以内。

2、支持.silk格式。

php调用实例:

header("Content-Type: text/html; charset=UTF-8");

$filename = "0.silk";

$data['file'] = "@" . dirname(__FILE__) . "/file/" . $filename;

$url = "http://silk2mp3.wlphp.com/api.php"; //接口地址

$content = curlPost($url, $data); //通过curl发送数据到接口

print_r($content);

/**

* @param $url 发送post请求的url

* @param $data 发送的数据

* @return mixed

*/

function curlPost($url, $data)

{

$ch = curl_init();

curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); //Problem (2) in the Chunked-Encoded data

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_AUTOREFERER, 1);

@curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); //php5.6.0开始,需要加上这行代码方可上传,否则取不到文件

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$tmpInfo = curl_exec($ch);

$errorno = curl_errno($ch);

if ($errorno) {

$rt['sta'] = "0";

$rt['msg'] = "curl错误:$errorno";

return json_encode($rt);

die;

}

return $tmpInfo;

}

返回实例:

{

"sta": 1,

"msg": "ok",

"url": "http://silk2mp3.wlphp.com/mp3/0.mp3"

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值