This article to introduce a PHP version of Taobao query product interface code example, the following to change your information in the code behind all have instructions, and the SDK package we also want to official download.
After downloading the SDK, directly referencing the package and creating the following class, and running it, that is, the process of the Calling interface (Taobao.user.seller.get) is completed (Invoke the interface description of the downloaded SDK)
Description
Topclient the instantiated class for invoking the SDK
Usersellergetrequest for API request Parameters Encapsulation class
Note: This interface is called in the sandbox environment, and the data obtained is also the data in the sandbox. To get the online environment, fill in the Appkey,appsecret that you created the application to get over and change the address of the calling interface's environment, while modifying Nick's name for the Taobao login .
Download the SDK package and put it in the same directory as the file.
Copy Code code as follows:
<?php
Header ("content-type:text/html; Charset=utf-8 ");
Include "topsdk.php";
Change the value of the topclient.php line 8th in the top of the download SDK after decompression to the $gatewayurl address: http://gw.api.tbsandbox.com/router/rest,
A formal environment requires that this address be set to: Http://gw.api.taobao.com/router/rest
Instantiate the Topclient class
$c = new Topclient;
$c->appkey = "xxxxxx"; Change your appkey.
$c->secretkey = "xxxxxxxx"; Change your secretkey.
$sessionkey = "xxxxxx"; such as sandbox test account sandbox_c_1 authorized after the SessionKey
Instantiate a specific API corresponding to the request class
$req = new Usersellergetrequest;
$req->setfields ("Nick,user_id,type");
$req->setnick ("sandbox_c_1");
Executing API requests and printing results
$resp = $c->execute ($req, $sessionkey);
echo "Result:";
Print_r ($RESP);
?>