Best way to read in a remote URL in a Scrip?

Hi all,
Just wondering what in everyones experience is the best way to
scavenge some data via a HTTP GET session to a remote server? I’ve got a
data-broker I built to interact with our inhouse DB system, and I just
need to construct queries like a HTML path to it, and then read the
results back.

I currently have some nasty 'back ticks' spawning lynx with a 

‘-dump’ option then a couple of lines of ‘clean-up’ regex’s… Is there
a more elegant or more efficent way to do this ?

Thanks

Adrian Carter
Technical Manager
Leading Edge Internet

Web http://www.lei.net.au http://support.lei.net.au
Direct +61 2 6163 6162 Support 1 300 662 415
E-mail cartera@lei.net.au

Hi all,
Just wondering what in everyones experience is the best way to
scavenge some data via a HTTP GET session to a remote server? I’ve got a
data-broker I built to interact with our inhouse DB system, and I just
need to construct queries like a HTML path to it, and then read the
results back.

I currently have some nasty ‘back ticks’ spawning lynx with a
’-dump’ option then a couple of lines of ‘clean-up’ regex’s… Is there
a more elegant or more efficent way to do this ?

Thanks

Somehow I am missing the connection to RT.

My bad :slight_smile:

I have incoming tickets and a whole crap-load of user-data and other
info thats stored in our in-house DB.

I’ve written a server-daemon that acts as a databroker to our internal
system, so I can just open a socket to it and make a request that looks
like:

“GET /username/password/CUST_ID/email:user@emailadress.com/1”

Which would authenticate against my database for the query, then
requests the Customer ID of the user based on a search of their primary
email: address. I also scavenge data like a contact phone and priorities
and which particular ISP/Division they belong to.

All of this happens on ticket creation via a Scrip that currently calls
a whole bunch of "my $variable = lynx -souce $blah" lines and then
calls some cleanup code to parse the reponse from the broker.

Im stuck on how to do this ‘better’. Obviously, in an external script,
i’d just do my own Socket control via IO::Socket… but Im having trouble
working out the most efficent way of opening a socket inside an RT
Scrip, writing some data, and then parsing the response. Is there some
built in curl support I can call upon ? LWP built in already ? how would
I go about calling LWP if I wanted to ?

The response is then used to populate CustomFields inside RT, hence
"this is where its all relevant to RT"

For background, I went down the whole ‘broker’ path because this way I
only need to worry about IPC between our in-house apps to the broker
level, and no external apps need to know the complicated selects and
views needed to return a simple piece of data like a phone number of
customer_id. In this fashion, apps just call to the socket with a fairly
’human readable’ command structure to extract data. The advantage is it
does away with needles database socket calls from multiple apps, and
most stuff nowdays supports socket calls of some description so its
easier to just implement that than make everything I want to talk to it
"DB Aware".

Thanks for taking the time to try and better understand what Im on about :slight_smile:

Adrian

Todd Chapman wrote:>On Mon, Jan 09, 2006 at 02:38:43PM +1100, Adrian Carter wrote:

Hi all,
Just wondering what in everyones experience is the best way to
scavenge some data via a HTTP GET session to a remote server? I’ve got a
data-broker I built to interact with our inhouse DB system, and I just
need to construct queries like a HTML path to it, and then read the
results back.

I currently have some nasty ‘back ticks’ spawning lynx with a
’-dump’ option then a couple of lines of ‘clean-up’ regex’s… Is there
a more elegant or more efficent way to do this ?

Thanks

Somehow I am missing the connection to RT.

Adrian Carter
Technical Manager
Leading Edge Internet

Web http://www.lei.net.au http://support.lei.net.au
Direct +61 2 6163 6162 Support 1 300 662 415
E-mail cartera@lei.net.au