Oracle UTL_HTTP

VERY cool…

I found some UTL_HTTP code that will make my life and possibly others easier.
In the past we’ve had some need for PL/SQL to “post” data to a URL (usually off campus) and retrieve the response.
Throughout many attempts, I have always been thwarted. But, at last, I have overcome. I found some code on the web that was already organized into a PL spec/body so I copied it and compiled. Looks simple, seemed to work OK. But I’ve pulled code off of webpages before, so that’s no big deal.

It’s the POST that’s complicated. AND the response.

So I did something naughty. I passed the form variables in the URL AND told the page to POST … and something magic happened. No errors. A little more screwing around and lo-and-behold – I found return data in the third header … or the 2nd one … I don’t remember. I tried again without doing both and I got errors and crashing and …

But it works. You can POST data to a website inside of the code, AND get a response AND do something about it … all on the server … all securely … all without pain or delay.

It’s brilliant.
The procedure also has the ability to use a username/password and a web proxy. These are details that might be handy to authenticate to our Wiki server, or mine data out of a website remotely. Who knows?

Leave a Reply