# CURL  command to VBA



## joebk (Apr 17, 2019)

>I am trying to send a pdf file from my hard drive
>to a website that parses the pdf file into and excel file
>and will get a <documentid> back as a response   so later i can pick the
>the corresponding CURL to send the pdf file
> 
>CURL -u <secret_api_key>     \
>     -F "file=@c:\users\Joek\documents\POG6050243.pdf  \
>     https://api.parser.com/document/upload/<parserid>
> 
>then
> 
>CURL   -u <secret_api_key>     \
>        https://api.parser.com/document/results/<parserid>/<documentid>
> 
>i have been able to ping the website
>i have been able to download a list of parserdocs <parserid>
>just don't understand how to send my pdf file
> 
>        FileName = "c:\users\Joek\documents\POG6050243.pdf"
>        fileContent = "application/pdf"
> 
>        URL = "https://api.parser.com/document/upload/      \
>        ypjtexyschjg?api_key=f9c1594326.........6bbb52016"
> 
>        Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
>        With objHTTP
>             .Open "POST", URL, False
>             .setRequestHeader "Authorization", "Basic " &
>        Base64Encode("mar@fittings.com" & ":" & "Chroma11oy!")
>             .setRequestHeader "Content-Type", "application/pdf"
>             .setRequestHeader "File", FileName
>             .send
>             strResponse = .responseText
>        End With


----------



## xenou (Apr 29, 2019)

If you haven't solved this yet, can you explain again? This is a little unclear. What exactly are you doing? What doesn't work? I can't tell from your post whether you are actually trying to write a vba script, or if these are just commands that you want to use in VBA. Or ?? What ??


----------

