<?php
// +----------------------------------------------------------------------
// | 订单侠开放平台 www.dingdanxia.com [ 专为淘客开发者提供一站式API解决方案 ]
// +----------------------------------------------------------------------
//接口秘钥
$apikey = '这里填写你的接口秘钥';
//京东创建推广位接口
$apiurl = "http://api.tbk.dingdanxia.com/jd/create_position";
//开始调用
$result = curl_post($apiurl, array(
//接口秘钥
"apikey" => $apikey,
"key" =>京东联盟获取的key参数,
"unionId" =>京东联盟获取的unionId参数,
"unionType" =>1,
//1:cps推广位 2:cpc推广位 一般选1就行
"type" =>1,
//站点类型 1网站推广位2.APP推广位3.社交媒体推广位4.聊天工具推广位5.二维码推广 对应你联盟下要申请那个应用的推广位
));
//打印结果
print_r($result);
/**
* post请求
* @param string $url
* @param array $params
* @param int $timeout
*/
function curl_post($url, $params, $timeout = 3) {
try {
foreach ($params as $key => $val) {
$post[] = "{$key}={$val}";
}
$post_data = implode('&', $post);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
return curl_exec($ch);
}
catch (Exception $e) {
return false;
}
}