维易淘客接口是用GET方式调用的,直接用GET调用即可,以下用PHP为例:
使用curl调用维易淘客接口高佣转链:
$api='http://api.vephp.com/hcapi?vekey=xxx¶=541470942175'; print_r (curl_get($api)); /** curl请求 */ function curl_get($url, $headers=[],$cookies='') { $ch = curl_init(); if(!empty($headers))curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_URL, $url); //curl_setopt($ch, CURLOPT_REFERER, 'https://www.taobao.com'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //curl_setopt($ch, CURLOPT_POST, 0); #curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); if($cookies) curl_setopt($ch, CURLOPT_COOKIE, $cookies); $result = curl_exec($ch); curl_close($ch); return $result; }
接口返回值:
{
"result": 2,
"data": {
"category_id": "50010404",
"coupon_click_url": "https://s.click.taobao.com/t?e=m%3D2%26s%3DjFpOKEpta9R....",
"commission_rate": "2.50",
"num_iid": "541470942175",
"original_uland_link": "https://uland.taobao.com/coupon/edetail?e=PfzDhz7bK8MGQAStt.....",
"tbk_pwd": "¥FInqbIPD9G6¥",
"coupon_short_url": "https://s.click.taobao.com/wvs7iGA"
}
}
相关参数直接在$api参数中传递