Extracting binary response from HTTP call within Omnis

Kelly Burgess kellyb at montana.com
Mon Nov 7 01:18:39 UTC 2022

Hi Andy,

Here's a method that takes a URL and returns the file as a binary.  HTTPPage is a stand-alone function, doesn't need a socket, connect, etc.


No. Parameter                Type            Subtype          Init.Val/Calc               Description
1   pThumbURL                Character       100000000

No. Local Variable           Type            Subtype          Init.Val/Calc               Description
1   pageBin                  Binary          100000000
2   pageBrk                  Binary          100000000        binfromhex('0D0A0D0A')
3   pos                      32 bit integer
4   thumbBin                Binary          100000000

No. Method text
1   ;  
2   HTTPPage (pThumbURL,443,kFalse) Returns pageBin
3   Calculate pos as binsearch(pageBrk,pageBin)
4   If pos>0
5     Calculate thumbBin as bytemid(pageBin,pos+4,binlength(pageBin)-1)
6   Else
7     Calculate thumbBin as ''
8   End If
9   Quit method thumbBin

More information about the omnisdev-en mailing list