Php taobao api development

Source: Internet
Author: User
Tags http request php code php tutorial

It's interesting to see the taobao api. By the way, let's take a php Tutorial.

Http://open.taobao.com/

After reading the api call method, assemble the url and then send an http request to interact with the server.

For details, refer to the following:Http://open.taobao.com/dev/index.php/Quick Start Guide

 

Take a look at the official demo, which is divided into two types: use and not use sdk. I do not like the sdk and cannot see the background implementation mechanism.

Let's take a look at the php code that does not use the sdk:Http://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

 

Util. php

There are two functions, one generating the md5 signature and the other assembling the url

Then, call these two functions based on the parameters, send an http request, and process the returned results.

 

I understand the principle. Copy, paste, and run it.

Stick the code and run... Http 500 error...

 

This can be difficult. I am also a beginner in php. I am looking for a mistake.

1. This sentence of the two functions in util. php: if ($ key! = ''& $ Val! = '') The quotation marks are missing.

2. Comment on the main file: // There is a problem with the space in front of the sandbox environment call address. Delete it.

... This official demo is also funny.

 

It can finally run and return a bunch of messy things, which is totally different from what the api tool returns.

Http://my.open.taobao.com/apitools/apitools.htm

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.