使用inet控件,上传图片 ,但总是失败。就是sina围勃(status/upload.xml)
有可能我的请求头有问题,也有可能是提交数据的格式有问题,总之HELPHeader = Header & "Content-Type:multipart/form-data; boundary=qwe-asd-zxc-sina-weibo" & vbCrLf
Header = Header & "Accept-Encoding: gzip,deflate" & vbCrLf
Header = Header & "Authorization:Basic " & SinaWB(Authori) & vbCrLf
Header = Header & "Content-Length: " & FileLen(Filename) + Len(SendData) + 1000 & vbCrLf
Header = Header & "Host: api.t.sina.com.cn" & vbCrLf
Header = Header & "Connection: Keep-Alive" & vbCrLf & vbCrLf
szCommand = szCommand & "--qwe-asd-zxc-sina-weibo" & vbCrLf
szCommand = szCommand & "Content-Disposition: form-data; name=""status""" & vbCrLf & vbCrLf
szCommand = szCommand & "tesing2011-01-20%2015%3A38%3A05" & vbCrLf
szCommand = szCommand & "--qwe-asd-zxc-sina-weibo" & vbCrLf
szCommand = szCommand & "Content-Disposition: form-data; name=""source""" & vbCrLf & vbCrLf
szCommand = szCommand & "1370882232" & vbCrLf
szCommand = szCommand & "--qwe-asd-zxc-sina-weibo" & vbCrLf
szCommand = szCommand & "Content-Disposition: form-data; name=""pic""; filename=""goodspc_logo.png""" & vbCrLf
szCommand = szCommand & "Content-Type: image/pjpeg" & vbCrLf & vbCrLf
szCommand = szCommand & FUJAN & vbCrLf
url = "http://api.t.sina.com.cn/statuses/upload.xml" '& Appkey & " &Status = " & SendData & " &pic = " & Filename
Form1.Inet1.url = "http://api.t.sina.com.cn/statuses/upload.xml"
Form1.Inet1.Execute url, "post", szCommand, Header
Do While Form1.Inet1.StillExecuting
DoEvents
Loop
binBuf = Form1.Inet1.GetChunk(2048, icByteArray)
SinaSendFUJAN = strToUn.UTF8_Decode(binBuf)
有可能我的请求头有问题,也有可能是提交数据的格式有问题,总之HELPHeader = Header & "Content-Type:multipart/form-data; boundary=qwe-asd-zxc-sina-weibo" & vbCrLf
Header = Header & "Accept-Encoding: gzip,deflate" & vbCrLf
Header = Header & "Authorization:Basic " & SinaWB(Authori) & vbCrLf
Header = Header & "Content-Length: " & FileLen(Filename) + Len(SendData) + 1000 & vbCrLf
Header = Header & "Host: api.t.sina.com.cn" & vbCrLf
Header = Header & "Connection: Keep-Alive" & vbCrLf & vbCrLf
szCommand = szCommand & "--qwe-asd-zxc-sina-weibo" & vbCrLf
szCommand = szCommand & "Content-Disposition: form-data; name=""status""" & vbCrLf & vbCrLf
szCommand = szCommand & "tesing2011-01-20%2015%3A38%3A05" & vbCrLf
szCommand = szCommand & "--qwe-asd-zxc-sina-weibo" & vbCrLf
szCommand = szCommand & "Content-Disposition: form-data; name=""source""" & vbCrLf & vbCrLf
szCommand = szCommand & "1370882232" & vbCrLf
szCommand = szCommand & "--qwe-asd-zxc-sina-weibo" & vbCrLf
szCommand = szCommand & "Content-Disposition: form-data; name=""pic""; filename=""goodspc_logo.png""" & vbCrLf
szCommand = szCommand & "Content-Type: image/pjpeg" & vbCrLf & vbCrLf
szCommand = szCommand & FUJAN & vbCrLf
url = "http://api.t.sina.com.cn/statuses/upload.xml" '& Appkey & " &Status = " & SendData & " &pic = " & Filename
Form1.Inet1.url = "http://api.t.sina.com.cn/statuses/upload.xml"
Form1.Inet1.Execute url, "post", szCommand, Header
Do While Form1.Inet1.StillExecuting
DoEvents
Loop
binBuf = Form1.Inet1.GetChunk(2048, icByteArray)
SinaSendFUJAN = strToUn.UTF8_Decode(binBuf)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货