上传一张图片,并发布一条消息到腾讯微博平台上。
API地址
发布普通微博(不带图片)已经成功,但是发布带图片的微博,总是报“签名失败”任务,功能类似的新浪微博已经测试成功,按照同样方式请求腾讯的这个,就失败。
而且返回信息也没有可以参考的baseString和true_sign。。。
特来此求助啊。。下面贴出的是从wireshark导出的排好格式HTTP报文
Hypertext Transfer Protocol
POST /t/add_pic_t HTTP/1.1\r\n
Content-Type: multipart/form-data; boundary=---------------------------8ced7f51516fed8\r\n
Host: openapi.qzone.qq.com\r\n
Content-Length: 8702\r\n
Expect: 100-continue\r\n
Connection: Keep-Alive\r\n
\r\n
[Full request URI: http://openapi.qzone.qq.com/t/add_pic_t]
MIME Multipart Media Encapsulation, Type: multipart/form-data, Boundary: "---------------------------8ced7f51516fed8"
[Type: multipart/form-data]
Preamble
First boundary: -----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="oauth_consumer_key"\r\n\r\n
我的APPKEY
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="oauth_nonce"\r\n\r\n
21536357
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="oauth_signature_method"\r\n\r\n
HMAC-SHA1
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="oauth_timestamp"\r\n\r\n
1332578912
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="oauth_token"\r\n\r\n
Data (20 bytes)
我的oauth_token
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="oauth_version"\r\n\r\n
1.0
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="oauth_signature"\r\n\r\n
nB+PdW3TMC2OT80L5/N6Gb67uk4=
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="content"\r\n\r\n
123
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part:
Content-Disposition: form-data; name="openid"\r\n\r\n
EFA33A7A0FEEF2A97CF9A3D57428167F
Boundary: \r\n-----------------------------8ced7f51516fed8\r\n
Encapsulated multipart part: (image/jpeg)
Content-Disposition: form-data; name="pic"; filename="System.Byte[]"\r\n
Content-Type: image/jpeg\r\n\r\n
JPEG File Interchange Format
Last boundary: \r\n-----------------------------8ced7f51516fed8--\r\n
换用dev.open.t.qq.com的接口代替。。。
用尽一切办法没有找到任何语言关于这个接口的实现。
你上传图片的这个地方是错误的filename="System.Byte[] 这里应该是文件名字才对
嗯,现在想来可能是这个问题,因为搜狐好像也是这样。
但是有些平台这么随便填也没事。