This article will introduce to you an example of the PHP version of Taobao's product query interface code. The following changes to your information are explained at the end of the code. At the same time, we also need to download the sdk package officially.
After downloading the SDK, directly reference the package, create the following class, and run it, which completes the process of calling the interface (taobao.user.seller.get) (the calling interface description can be found in the downloaded SDK)
Instructions:
TopClient is the instantiated class for calling the SDK
UserSellerGetRequest is the API request parameter encapsulation class
Note: This interface is called in a sandbox environment, and the data obtained is also a sandbox Medium data. To obtain the online environment, please fill in the appkey and appsecret obtained by creating the application yourself, change the environment address of the calling interface, and change the nick to Taobao login name .
Download the SDK package and unzip it and place it in the same directory as the file.
Copy code The code is as follows:
header("Content-type: text/html; charset=utf -8");
include "TopSdk.php";
//Change the value of $gatewayUrl in line 8 of TopClient.php in top after decompressing the downloaded SDK to the sandbox address: http://gw. api.tbsandbox.com/router/rest,
//In the formal environment, this address needs to be set to: http://gw.api.taobao.com/router/rest
//Instantiation TopClient class
$c = new TopClient;
$c->appkey = "xxxxxx"; //Replace with your appkey
$c->secretKey = "xxxxxxxx"; //Replace with Your secretKey
$sessionkey= "xxxxxx"; //Such as the sessionkey obtained after authorization by sandbox test account sandbox_c_1
//Instantiate the Request class corresponding to the specific API
$req = new UserSellerGetRequest;
$req->setFields("nick,user_id,type");
//$req->setNick("sandbox_c_1");
//Execute API request and print the result
$resp = $c->execute($req,$sessionkey);
echo "result:";
print_r($resp);
?>
http://www.bkjia.com/PHPjc/825355.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825355.htmlTechArticleThis article will introduce to you an example of the PHP version of Taobao's product query interface code. The following needs to be changed to your information. There are instructions at the back of the code, and we also need to download the sdk package officially. ...
Statement: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