Xymon Mailing List Archive search

URLplus

list Ralph Mitchell
Wed, 30 Apr 2008 12:28:46 -0500
Message-Id: <user-906f966bb5a7@xymon.invalid>

Unfortunately it's not just one script.  I've found many variations in login
pages, so I've had to customize the scripts for each different target.  Some
logins require a form to be posted back, others are handled via
WWW-Authenticate pop-up boxes and sometimes redirects have to be followed.
That's not hard if the site uses Location headers, because curl can handle
those, but I've also found meta-refresh tags and several types of javascript
"go-elsewhere" redirects that have to be individually scripted.

I posted something a year or so ago that might get you started.  If I can
find it, I'll post it again.

Ralph Mitchell


On Wed, Apr 30, 2008 at 3:16 AM, Thomas Laurids Pedersen <user-934e986710b3@xymon.invalid>
wrote:
 Would you share the bourne script. I need something quickly for only 1
site at the moment, so anything will do.

Regards, Thomas

[image: Inactive hide details for "Ralph Mitchell"
<user-00a5e44c48c0@xymon.invalid>]"Ralph Mitchell" <user-00a5e44c48c0@xymon.invalid>


    *"Ralph Mitchell" <user-00a5e44c48c0@xymon.invalid>*

            29-04-2008 22:04
            Please respond to
            user-ae9b8668bcde@xymon.invalid


To

user-ae9b8668bcde@xymon.invalid
cc


Subject

Re: [hobbit] URLplus

On Tue, Apr 29, 2008 at 2:28 PM, Thomas Laurids Pedersen <*user-934e986710b3@xymon.invalid*<user-934e986710b3@xymon.invalid>>
wrote:

   Can this new extension do the post like the builtin http test can do
      ?

      Regards, Thomas


I don't think so, as it currently stands. This line:

$ret=qx(curl -m $tout -s -k -S $pstr "$url" 2>&1);

in showUrl is the bit that actually fetches the web page. To do a POST
using curl, you would need to change that to:

$ret=qx(curl -m $tout -s -k -S -d $postArgs $pstr "$url" 2>&1);

with matching additions elsewhere to fill the $postArgs variable with
whatever you want to post. If you're wanting to implement something that
performs a login, you'd probably want to track cookies as well.

I'm not much of a perl programmer, so I'm not confident about making such
changes. On the other hand, I've done quite a lot of this in Bourne shell...

Ralph Mitchell