国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 PHP源碼 淘寶開放API根據(jù)賣家昵稱獲取賣家店鋪ID

淘寶開放API根據(jù)賣家昵稱獲取賣家店鋪ID

Mar 30, 2017 am 10:37 AM

淘寶開放API菜鳥教程根據(jù)賣家昵稱獲取賣家店鋪ID

<php 
header("Content-Type:text/html;charset=UTF-8"); 
/*本程序功能:根賣家昵稱獲取賣家店鋪sid,還有店鋪標題*/ 
//config 
$appKey = &#39;12345678; //你的密匙 
$appSecret = &#39;123456789&#39;; 
$usernick = &#39;grayvoice&#39;; //你的用戶名 
$salenick= &#39;缺水魚兒&#39;; //賣家昵稱 
//簽名函數(shù) 
function createSign ($paramArr) { 
global $appSecret; 
$sign = $appSecret; 
ksort($paramArr); 
foreach ($paramArr as $key =>$val) { 
if ($key !=&#39;&#39; && $val !=&#39;&#39;) { 
$sign .= $key.$val; 
} 
} 
$sign = strtoupper(md5($sign)); 
return $sign; 
} 
//組參函數(shù) 
function createStrParam ($paramArr) { 
$strParam = &#39;&#39;; 
foreach ($paramArr as $key => $val) { 
if ($key != &#39;&#39; && $val !=&#39;&#39;) { 
$strParam .= $key.&#39;=&#39;.urlencode($val).&#39;&&#39;; 
} 
} 
return $strParam; 
} 
//解析xml函數(shù) 
function getXmlData ($strXml) { 
$pos = strpos($strXml, &#39;xml&#39;); 
if ($pos) { 
$xmlCode=simplexml_load_string($strXml,&#39;SimpleXMLElement&#39;, LIBXML_NOCDATA); 
$arrayCode=get_object_vars_final($xmlCode); 
return $arrayCode ; 
} else { 
return &#39;&#39;; 
} 
} 

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( 
&#39;app_key&#39; => $appKey, 
&#39;method&#39; => &#39;taobao.shop.get&#39;, 
&#39;format&#39; => &#39;xml&#39;, 
&#39;v&#39; => &#39;1.0&#39;, 
&#39;timestamp&#39; => date(&#39;Y-m-d H:i:s&#39;), 
&#39;fields&#39; => &#39;sid,nick,title&#39;,
/*想要返回的數(shù)據(jù)的相應(yīng)參數(shù),sid對應(yīng)賣家店鋪id,nick對應(yīng)賣家昵稱,這里其實不用返回,因為已經(jīng)知道了嘛。
title對應(yīng)賣家店鋪標題,也就是店鋪名稱*/ 
&#39;nick&#39; => $salenick //賣家昵稱 

); 
//生成簽名 
$sign = createSign($paramArr); 
//組織參數(shù) 
$strParam = createStrParam($paramArr); 
$strParam .= &#39;sign=&#39;.$sign; 
//訪問服務(wù) 
$url = &#39;http://gw.api.taobao.com/router/rest&#39;.$strParam; 
$result = file_get_contents($url); 
$result = getXmlData($result); 
$sid = $result[&#39;shop&#39;][&#39;sid&#39;]; //返回賣家店鋪ID 
$nick = $result[&#39;shop&#39;][&#39;nick&#39;]; //返回賣家昵稱 
$title = $result[&#39;shop&#39;][&#39;title&#39;]; //返回賣家店鋪標題 
>

以上就是淘寶開放API根據(jù)賣家昵稱獲取賣家店鋪ID的內(nèi)容,更多相關(guān)內(nèi)容請關(guān)注PHP中文網(wǎng)(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 AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)