请问一下淘宝API示例代码的几行代码100分

WBOY
Release: 2016-06-13 13:32:24
Original
945 people have browsed it

请教一下淘宝API示例代码的几行代码100分
$c = new TopClient;
$c->appkey = appkey;
$c->secretKey = secret;
$req = new UserGetRequest;
$req->setFields("user_id,nick,seller_credit");
$req->setNick("hz0799");
$resp = $c->execute($req, $sessionKey);

以上是淘宝提供的SDK示例
这其中的 
$c = new TopClient;
这个类应该是什么内容?


------解决方案--------------------
TopClient为调用SDK的实例化类
UserGetRequest为API的请求参数封装类
这在 http://dev.open.taobao.com/dev/index.php/PHP%E8%B0%83%E7%94%A8%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%EF%BC%88%E4%BD%BF%E7%94%A8SDK%EF%BC%89

举个常用的例子
topClient就是类似负责连接mysql数据库并执行查询的
UserGetRequest就是负责生成SQL语句的

大概就是这样,具体你可以看看它SDK的源码,半小时也许就能弄懂
------解决方案--------------------
你只需保证流程和传输的数据格式正确就行,自己想写怎样都行。淘宝不关心你用没用他们的SDK
不过话说回来最好还是用现成的代码,久经考验没有漏洞逻辑严密都是它的优点
------解决方案--------------------
http://test.taoapi.com/Sdk/Taoapi_Php_Sdk_V2.3.1.rar

SDK

http://test.taoapi.com/Sdk/Taoapi_Php_Sdk_V2.3.1_Demo.rar

Demo

用这个SDK吧.demo也很完善 直接就可以来用了.

Related labels:
source:php.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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template