Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, Monks.

I have this command -
curl --connect-timeout 15 "http://user:pass@hostip/bin/xml_agent" -d " +xml_cmd=<request_raw>show stats</request_raw>"
Instead of using the system command and WWW::Curl, is there another way I can write in perl?

Replies are listed 'Best First'.
Re: CURL Alternative.
by ikegami (Patriarch) on Mar 19, 2008 at 05:32 UTC
    Perl has a very good HTTP library: LWP. $ua->credentials() can be used to supply the user and passwd. I don't know what -d does, so I can't recommend anything for that.
      You can also embed username and password in the URL with LWP::UserAgent, just like in curl.
      -d does a POST. The whole thing feeds the request to the HEADER and sends POST Data. The result of that command is in an XML format. Once I have that, I can parse it (TIMTOWTDI).