Foxtable(狐表)用户栏目专家坐堂 → 有关调用外部接口如何接收接口文件


  共有2605人关注过本帖树形打印复制链接

主题:有关调用外部接口如何接收接口文件

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/18 10:29:00 [显示全部帖子]

得到的数据是base64的字符串,转换成文件即可。

 

如果是保存成图片,代码这样写

 

Dim str As String = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAB2AFoDASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3 uLm6wsPExcbHyMnK0t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QyjaFweRx/hW+qkIoDSgY/vGsbw3CoSGWADMiqM49hn+dd wsaBQNvQV5jtfQpSaEkJX5X2qeeCfbj9a8V+KjCTX4sbcpHzj6//AFq9vvCuMOcIOTXhnxD/AHvi KQ5ZsgdeoxmtKXxhDc4GfJG4dTn+dQ24M15DEPvOwUfyrQljOwY6AZNV9OQJq8JwCVdevTNd/MnF jauz6M0ETw2MUO0bBgdc8Y65rYHmjJYMRzjI4qhomH0yF/MjO7GADxnjIrVYtypl+XO0sW6+1eYK UrlB0kmQrcKSgII7YPOK8I8eIV11ISzHaxBB7HNfQMuERv3qDbwRkcGvCvH1sq+LnCurnaCSDkA1 tQdp3BybOKlG2z/3XI/Slt281UJ4IbtUt+mIHK9Mlqi005k29t6/4V26ctyT6A8HErplqQD80Sk5 GO3FdoFBAri/DLNHDbw42hI1GPXiu1H3R9K8tO+o2rMrasxWDIxkV4j4zm+0eI7gjdgIoG7r8wFF Fa0viLhsctMgMmAON2PyrOgQD97j5i+7NFFdkdg+0fSfhrE/h21lVFVyvJA6gVquFVidq4GSBtGO Bnn35oorzyZbj9iEsQg28hc9iK8I8XOZvE8rnA6D9KKK0pfEScTfL+6jHbj+tJpHzzBfVs/rRRXo S/hsZ754ZB8pGZizMckmuyX7o+lFFeWI/9k="
try
    Dim bs As Byte() = Convert.FromBase64String(str)
    Dim stream As System.IO.Stream = New System.IO.MemoryStream(bs)
    Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream)
    bmp.Save("d:\test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
catch ex As exception
    msgbox("出错")
End try

 

 

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/18 10:31:00 [显示全部帖子]

如果是保存成文件,这样写

 

Dim str As String = "/9j/4AAQSkZJRgABAQAAAQ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HaxBB7HNfQMuERv3qDbwRkcGvCvH1sq+LnCurnaCSDkA1 tQdp3BybOKlG2z/3XI/Slt281UJ4IbtUt+mIHK9Mlqi005k29t6/4V26ctyT6A8HErplqQD80Sk5 GO3FdoFBAri/DLNHDbw42hI1GPXiu1H3R9K8tO+o2rMrasxWDIxkV4j4zm+0eI7gjdgIoG7r8wFF Fa0viLhsctMgMmAON2PyrOgQD97j5i+7NFFdkdg+0fSfhrE/h21lVFVyvJA6gVquFVidq4GSBtGO Bnn35oorzyZbj9iEsQg28hc9iK8I8XOZvE8rnA6D9KKK0pfEScTfL+6jHbj+tJpHzzBfVs/rRRXo S/hsZ754ZB8pGZizMckmuyX7o+lFFeWI/9k="
Dim bs() As Byte = Convert.FromBase64String(str)
Dim ms As New IO.FileStream("d:\000.jpg", IO.FileMode.Create)
ms.Write(bs, 0,bs.length)
ms.close


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/18 10:32:00 [显示全部帖子]

参考5楼代码

 回到顶部