Fetching an HTML page with Userid and Password?

Hi,

I need to script a fetch command that will satisfy a UserID andPassowrd requirement.

/tool fetch …
http://10.6.0.1/goform/admin/formReboot
with userid admin and password 12345

This is to reboot an ADSL modem via script…

Thanks
Brian
Zimbabwe

/tool fetch user=admin password=12345 …



/tool fetch user=admin password=12345 address=10.6.0.1 mode=http src-path="goform/admin/formReboot";

status: failed

failure: connection failed

How are the username and password sent to the other end? What is actually at the other end? Is it under your control (as in, can you alter the script that processes the HTTP request)?

The example above would work if the other end accepts an HTTP username and password. Since it didn’t worked… is it probably using a POST password (you know, from an HTML form; without having the username and password appear in the URL)? If so… you can’t do that with fetch. This command can only GET, it can’t POST.

If you can edit the script at the remote end, alter it to accept GET parameters instead of POST ones (or better yet, accept them as an alternative).

If you can’t edit the script at the remote end, you could create a script on a web server that you do have control over, and make that the remote end of your router script. The web server will serve as a proxy - you tell it what to do, it does it for you, and gives you back the results.

Thanks for the info. Quite correct, the page I was trying to call used a POST command.

I have resolved the problem by using telnet and a Windows app tst10.exe which I then run at regular intervals using a cron app on the PC adjacent to the RB750 that feeds traffic to the adsl modems, that ensures that the adsl modems will be rebooted every 4 hours. The RB750 connected to these modems reroutes the traffic 1 minute before the modem reboot, and once the modem is back up, it routes back through the modem. The PC time syncs from the ntp server on the RB750.

I tried Expect and failed dismally, probably because I am in too much of a hurry to learn how it works properly, so tst10 works perfectly, as the telnet sequence is identical each time, it just reads from a text file.

tst10 is an open source app, would be great if it could be integrated into a future version of ROS :slight_smile:

Thanks to both of you who offered assistance.