<?php
$url = $_POST['url'];
preg_match('|template_id=(.*?)&|i', $url, $id);

$time = time();
$sign = md5('9e2c|mplates|0||'.$time.'||11ac');
// 发送post数据
$ch = curl_init();
$postData = json_encode(array('sdk_version' =>'100.0.0' ,'id'=>array($id[1])));
$headers = array();
$headers[] = 'Content-Type: application/json;charset=UTF-8';
$headers[] = 'device-time: '.$time;
$headers[] = 'pf: 0';
$headers[] = 'sign: '.$sign;
$headers[] = 'sign-ver: 1';
curl_setopt($ch, CURLOPT_URL, 'https://lv-api.ulikecam.com/lv/v1/replicate/multi_get_templates');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$result = curl_exec($ch);
curl_close($ch);
//echo $result;
$jsondata = json_decode($result, true);
$video_url = $jsondata['data']['templates'][0]['video_url'];
$cover_url = $jsondata['data']['templates'][0]['cover_url'];
$desc = $jsondata['data']['templates'][0]['title'];

if (!empty($video_url)) {
exit(json_encode(array('pages' => 0,
'total' => '1',
'video' => array(array('url' => $video_url,
'thumb' => $cover_url,
'desc' => $desc)),
'status' => 'ok'
)));
} else {
exit(json_encode(array('status' => 'error', 'message' => '数据获取失败,欢迎加入网站底部QQ群提交错误信息!')));
}


Back to home | File page

Subscribe | Register | Login | N