PHP version of Taobao query merchandise interface code example _php tips

Source: Internet
Author: User

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);
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.