<?php
//引用config.php
include 'config.php';
$stopAdvertImage = "http://www.image.com";
$stopAdvertHref = "http://www.href.com";
$channelId="123713";
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'stopAdvertImage' => $stopAdvertImage,
'stopAdvertHref' => $stopAdvertHref
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$url="http://api.polyv.net/live/v2/channelAdvert/".$channelId."/updateStop";
function post($url, $post_data = '', $timeout = 5){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
if($post_data != ''){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
$params["sign"] = $sign;
echo post($url, $params);
?>