此接口可以获取拼多多爆款商品,方便我们做专题推广,或者做热销榜
接口地址:https://www.dingdanxia.com/doc/82/86
测试地址:https://www.dingdanxia.com/apitest/82/86 (建议使用此项测试数据)
PHP代码示例:
echo http_post("http://api.tbk.dingdanxia.com/pdd/goodslist",array( 'apikey' =>‘个人中心>系统设置>接口管理>获取apikey’, 'limit'=>10, )); function http_post($url,$param,$post_file=false,$header = null){ $oCurl = curl_init(); if (is_array($header)) { curl_setopt($oCurl, CURLOPT_HTTPHEADER, $header); } if(stripos($url,"https://")!==FALSE){ curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1 } if (is_string($param) || $post_file) { $strPOST = $param; } else { $aPOST = array(); foreach($param as $key=>$val){ $aPOST[] = $key."=".urlencode($val); } $strPOST = join("&", $aPOST); } curl_setopt($oCurl, CURLOPT_URL, $url); curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($oCurl, CURLOPT_POST,true); curl_setopt($oCurl, CURLOPT_POSTFIELDS,$strPOST); $sContent = curl_exec($oCurl); $aStatus = curl_getinfo($oCurl); curl_close($oCurl); if(intval($aStatus["http_code"])==200){ return $sContent; }else{ return false; } }