Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $access_token = "token*********"
- ;$uid = 470341585
- $file_path = @ScriptDir&"\dropbox.zip"
- $file_content = FileRead($file_path)
- $file_handle = FileOpen($file_path,16)
- $file_binary = FileRead($file_handle)
- Dropboxapi_oathv2_download("/dropbox.zip",$file_binary,$access_token)
- Func Dropboxapi_oathv2_download($path,$binary,$access_token,$token_type="Bearer")
- Local $apiUrl = "https://content.dropboxapi.com/2/files/download"
- Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
- $oHTTP.Open("POST", $apiUrl, False)
- $oHTTP.SetRequestHeader("Authorization", $token_type & " " & $access_token)
- $oHTTP.SetRequestHeader("Dropbox-API-Arg", '{"path": "' & $path & '" }')
- $oHTTP.Send($file_content)
- Local $oReceived = $oHTTP.ResponseText
- Local $oStatusCode = $oHTTP.Status
- If $oStatusCode = 200 Then
- ConsoleWrite("$Received:" & $oReceived & @CRLF)
- Return $oReceived
- Else
- ConsoleWrite("$Received:" & $oReceived & @CRLF & "Error:" & $oStatusCode & @CRLF)
- SetError($oStatusCode)
- EndIf
- EndFunc
Add Comment
Please, Sign In to add comment