<php header("Content-Type:text/html;charset=UTF-8"); /*本程序功能:根賣家昵稱獲取賣家店鋪sid,還有店鋪標(biāo)題*/ //config $appKey = '12345678; //你的密匙 $appSecret = '123456789'; $usernick = 'grayvoice'; //你的用戶名 $salenick= '缺水魚兒'; //賣家昵稱 //簽名函數(shù) function createSign ($paramArr) { global $appSecret; $sign = $appSecret; ksort($paramArr); foreach ($paramArr as $key =>$val) { if ($key !='' && $val !='') { $sign .= $key.$val; } } $sign = strtoupper(md5($sign)); return $sign; } //組參函數(shù) function createStrParam ($paramArr) { $strParam = ''; foreach ($paramArr as $key => $val) { if ($key != '' && $val !='') { $strParam .= $key.'='.urlencode($val).'&'; } } return $strParam; } //解析xml函數(shù) function getXmlData ($strXml) { $pos = strpos($strXml, 'xml'); if ($pos) { $xmlCode=simplexml_load_string($strXml,'SimpleXMLElement', LIBXML_NOCDATA); $arrayCode=get_object_vars_final($xmlCode); return $arrayCode ; } else { return ''; } } function get_object_vars_final($obj){ if(is_object($obj)){ $obj=get_object_vars($obj); } if(is_array($obj)){ foreach ($obj as $key=>$value){ $obj[$key]=get_object_vars_final($value); } } return $obj; } //參數(shù)數(shù)組 $paramArr = array( 'app_key' => $appKey, 'method' => 'taobao.shop.get', 'format' => 'xml', 'v' => '1.0', 'timestamp' => date('Y-m-d H:i:s'), 'fields' => 'sid,nick,title', /*想要返回的數(shù)據(jù)的相應(yīng)參數(shù),sid對應(yīng)賣家店鋪id,nick對應(yīng)賣家昵稱,這里其實不用返回,因為已經(jīng)知道了嘛。 title對應(yīng)賣家店鋪標(biāo)題,也就是店鋪名稱*/ 'nick' => $salenick //賣家昵稱 ); //生成簽名 $sign = createSign($paramArr); //組織參數(shù) $strParam = createStrParam($paramArr); $strParam .= 'sign='.$sign; //訪問服務(wù) $url = 'http://gw.api.taobao.com/router/rest'.$strParam; $result = file_get_contents($url); $result = getXmlData($result); $sid = $result['shop']['sid']; //返回賣家店鋪ID $nick = $result['shop']['nick']; //返回賣家昵稱 $title = $result['shop']['title']; //返回賣家店鋪標(biāo)題 >
以上就是淘寶開放API根據(jù)賣家昵稱獲取賣家店鋪ID的內(nèi)容,更多相關(guān)內(nèi)容請關(guān)注PHP中文網(wǎng)(www.miracleart.cn)!
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article
Guide: Stellar Blade Save File Location/Save File Lost/Not Saving
4 weeks ago
By DDD
Oguri Cap Build Guide | A Pretty Derby Musume
2 weeks ago
By Jack chen
Agnes Tachyon Build Guide | A Pretty Derby Musume
2 weeks ago
By Jack chen
Dune: Awakening - Advanced Planetologist Quest Walkthrough
4 weeks ago
By Jack chen
Date Everything: Dirk And Harper Relationship Guide
4 weeks ago
By Jack chen

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
