接口请求地址

请求URL地址: http://word2pdf.wlphp.com/api.php       如果转成的pdf出现中文乱码,请检查字体以及字号


上传word文档

上传word文档

支持word文档

上传word文档注意事项

1、word文档大小尽量保持在10M以内。

2、支持word文档格式。

php调用实例:
header("Content-Type: text/html; charset=UTF-8");	
$filename = "20170410高原风红包卡册系统定制要求.doc";  //上传文件名字 必须是doc或者docx的
$filename = iconv("utf-8", "gbk", $filename);
$data['doc'] = "@" . dirname(__FILE__) . "/doc/" . $filename;
$url = "http://word2pdf.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://word2pdf.wlphp.com/pdf/20170410高原风红包卡册系统定制要求.pdf"
}