I use c language to write a piece of code, send the content below, to obtain the authorization of baidu device,
Openapi.baidu.com
Hostname:developer.n.shifen.com
Hostip: 111.202.114.136
The socket connect ok
Send: GET/request/2.0/device/code? Client_id=nou9TtG7BHW7KKEGxU6ykrPXpjHQyEA6 & amp; The payload=device_code HTTP/1.1
Host: openapi.baidu.com
Accept: image/GIF image/jpeg, text/HTML and application/XHTML + XML, application/XML. Q=0.9 */*; Q=0.8
The Accept - Language: useful - cn
The user-agent: Mozilla/5.0 (X11; Ubuntu. Linux x86_64; The rv: 18.0)
The content-type: application/x - WWW - form - urlencoded; Charset=utf-8
Connection: close
Cookie: BAIDUID=89 ca69b3e3c434728cef9ddf38e93362: FG=1; Expires=Thu, - Dec 31 to 37 23:55:55 GMT; Max - age=2145916555; Path=/; Domain=.baidu.com; Version=1
Client_id=nou9TtG7BHW7KKEGxU6ykrPXpjHQyEA6 & amp; The payload=device_code
Returns the result as follows:
Read: 266
Headlen: 266
READ: HTTP/1.1 302 Found
The content-type: text/HTML
Date: Thu, 14 Sep 2017 01:44:51 GMT
Location: https://openapi.baidu.com/oauth/2.0/device/code? Client_id=nou9TtG7BHW7KKEGxU6ykrPXpjHQyEA6 & amp; The payload=device_code
Server: Apache
The Content - Length: 0
Connection: close
Excuse me, ladies and gentlemen, I write wrong? Thank you