|
Sub autore()
Dim str1 As String
With CreateObject("winhttp.winhttprequest.5.1")
Url = "http://biaozhun.osta.org.cn/api/v1/profession/detail"
.Open "post", Url
.setRequestHeader "Accept", "application/json, text/javascript, */*; q=0.01"
.setRequestHeader "Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
.setRequestHeader "Origin", "http://biaozhun.osta.org.cn"
.setRequestHeader "Proxy-Connection", "keep-alive"
.setRequestHeader "Referer", "http://biaozhun.osta.org.cn/pdfview.html?code=544"
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.43"
.setRequestHeader "X-Requested-With", "XMLHttpRequest"
.setRequestHeader "x-forwarded-for", "1.1.1.1"
.send ("code=544")
str1 = Split(Split(.responsetext, "data"":""")(1), """}")(0)
End With
SaveBinaryDataToFile Base64Decode(str1), "D:\1.pdf"
End Sub
Sub SaveBinaryDataToFile(BinaryData() As Byte, FilePath As String)
Dim FileHandle As Integer ' 文件句柄
Dim NumBytesWritten As Long ' 写入字节数
FileHandle = FreeFile ' 获取一个可用的文件句柄
Open FilePath For Binary Access Write As #FileHandle ' 以二进制模式打开文件
Put #FileHandle, , BinaryData ' 将二进制数据写入文件
Close #FileHandle ' 关闭文件
End Sub
Function Base64Decode(Base64String As String) As Byte()
Dim Base64XML As Object
Set Base64XML = CreateObject("MSXML2.DOMDocument.6.0")
Dim Base64Node As Object
Set Base64Node = Base64XML.createElement("b64")
Base64Node.DataType = "bin.base64"
Base64Node.Text = Base64String
Dim DecodedByteStream() As Byte
DecodedByteStream = Base64Node.nodeTypedValue
Base64Decode = DecodedByteStream
End Function
|
评分
-
2
查看全部评分
-
|