Home Backend Development PHP Tutorial taobao.item.add上传图片的有关问题

taobao.item.add上传图片的有关问题

Jun 13, 2016 am 10:29 AM
gt key sign

求助taobao.item.add上传图片的问题
商品会传,但是图片不知道怎么上传

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpheader ("Content-Type: multipart/form-data; charset=utf-8");require_once "include\Snoopy.class.php";$appSecret = 'XXX'; //填写自己申请的$appSecret$app_key='XXX';$url = 'http://gw.api.taobao.com/router/rest?';  //正式环境提交URL,一般情况下不要改        $paramArr = array(            'method' => 'taobao.item.add',   //API名称            'session' => 'XXX',   //sessionkey            'timestamp' => date('Y-m-d H:i:s'),            'format' => 'xml',  //返回格式,本demo仅支持xml            'app_key' => 'XXX',  //Appkey            'v' => '2.0',   //API版本号            'sign_method'=> 'md5', //签名方式             'num'=> '200', //商品数量             'price'=> '20', //商品价格             'type'=> 'fixed', //发布类型             'stuff_status'=> 'new', //新旧程度             'approveStatus'=>'instock',             'title'=> '油画入门', //标题             //'image'=> [email protected]', //商品价格             'desc'=> 'imageimageimageimage', //商品描述             'location.state'=> '上海', //省             'location.city'=> '上海', //市             'cid'=> '50005701', //淘宝类目             'seller_cids'=> '244664972', //店铺类目             'freight_payer'=> 'buyer', //邮费模板             'postage_id'=> '2790119', //邮费模板             'props'=> '1636953:2147483647;', //商品属性             'input_pids'=> '1636953', //商家编码             'input_str'=> '9787508347394', //商品属性                     );        //生成签名        $paramArr['sign']= createSign($paramArr,$appSecret);        //组织参数        $strParam .= 'sign='.$sign;        //构造Url        $reqHttp = new Snoopy();        $reqHttp->submit($url,$paramArr);         //$paramArr['image']= array('image'=>[email protected]'); //商品价格        $r=getXmlData($reqHttp->results);        print_r($r);//以下为SKD内容    //签名函数    function createSign ($paramArr) {        global $appSecret;        $sign = $appSecret;        ksort($paramArr);        foreach ($paramArr as $key => $val) {           if ($key !='' && $val !='') {               $sign .= $key.$val;           }        }        $sign = strtoupper(md5($sign.$appSecret));        return $sign;    }    //组参函数    function createStrParam ($paramArr) {        $strParam = '';        foreach ($paramArr as $key => $val) {           if ($key != '' && $val !='') {               $strParam .= $key.'='.urlencode($val).'&';           }        }        return $strParam;    }    //解析xml函数    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;    }?>
Copy after login


------解决方案--------------------
到taobao open平台去询问要更多人知道些.
我忘记了,我记得好像也是有SDK什么可以直接调用的.
------解决方案--------------------
应该直接给封好库了,底层肯定是curl之类往上post的multipart/form-data。
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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

How to use the SIGN function in Excel to determine the sign of a value How to use the SIGN function in Excel to determine the sign of a value May 07, 2023 pm 10:37 PM

The SIGN function is a very useful function built into Microsoft Excel. Using this function you can find out the sign of a number. That is, whether the number is positive. The SIGN function returns 1 if the number is positive, -1 if the number is negative, and zero if the number is zero. Although this sounds too obvious, if you have a large column containing many numbers and we want to find the sign of all the numbers, it is very useful to use the SIGN function and get the job done in a few seconds. In this article, we explain 3 different methods on how to easily use the SIGN function in any Excel document to calculate the sign of a number. Read on to learn how to master this cool trick. start up

What does the identity attribute in SQL mean? What does the identity attribute in SQL mean? Feb 19, 2024 am 11:24 AM

What is Identity in SQL? Specific code examples are needed. In SQL, Identity is a special data type used to generate auto-incrementing numbers. It is often used to uniquely identify each row of data in a table. The Identity column is often used in conjunction with the primary key column to ensure that each record has a unique identifier. This article will detail how to use Identity and some practical code examples. The basic way to use Identity is to use Identit when creating a table.

How SpringBoot monitors redis Key change events How SpringBoot monitors redis Key change events May 26, 2023 pm 01:55 PM

1. Function Overview Keyspace notification allows clients to receive events that modify Rediskey changes in some way by subscribing to channels or patterns. All commands that modify key keys. All keys that received the LPUSHkeyvalue[value…] command. All expired keys in the db database. Events are distributed through Redis's subscription and publishing functions (pub/sub), so all clients that support subscription and publishing functions can directly use the keyspace notification function without any modifications. Because the current subscription and publishing functions of Redis adopt a fireandforget strategy, if your program

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

How to solve the problem of batch deletion of key values ​​in redis How to solve the problem of batch deletion of key values ​​in redis May 31, 2023 am 08:59 AM

Problems encountered: During the development process, you will encounter keys that need to be deleted in batches according to certain rules, such as login_logID (ID is a variable). Now you need to delete data such as "login_log*", but redis itself only has batch query. Command keys for class key values, but there is no command for batch deletion of a certain class. Solution: Query first, then delete, use xargs to pass parameters (xargs can convert pipe or standard input (stdin) data into command line parameters), execute the query statement first, and then remove the queried key value and the original del parameters. delete. redis-cliKEYSkey* (search condition)|xargsr

Unpatchable Yubico two-factor authentication key vulnerability breaks the security of most Yubikey 5, Security Key, and YubiHSM 2FA devices Unpatchable Yubico two-factor authentication key vulnerability breaks the security of most Yubikey 5, Security Key, and YubiHSM 2FA devices Sep 04, 2024 pm 06:32 PM

An unpatchable Yubico two-factor authentication key vulnerability has broken the security of most Yubikey 5, Security Key, and YubiHSM 2FA devices. The Feitian A22 JavaCard and other devices using Infineon SLB96xx series TPMs are also vulnerable.All

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

See all articles