http requests of a password encrypted page

C

csjasnoch

I am running a script to issue a script run on a video server. The only
way I really have to issue the command is via http it seems (or through
the WUI for the server).

So is there anyway to put the user name in and password for when the
prompt comes up?

For example this is what I want to request,

<server ip>/evscript?runcmd=start

however, if I were to issue this command via web browser a prompt will
come up for my user name and password. But doing this with a script as

require 'net/http'
server = Net::HTTP.new(<server ip>,80)
resp, data = server.get("/evscript?runcmd=start",nil)

will return

#<Net::HTTPUnathorized 401 readbody=true>, (unathorized HTML code
display)

or maybe there is another way I could do this than using 'net/http'??

Thank you in advance.

-Collin
 
R

Rimantas Liubertas

On 7/23/05 said:
however, if I were to issue this command via web browser a prompt will
come up for my user name and password. But doing this with a script as
=20
require 'net/http'
server =3D Net::HTTP.new(<server ip>,80)
resp, data =3D server.get("/evscript?runcmd=3Dstart",nil)
=20
will return
=20
#<Net::HTTPUnathorized 401 readbody=3Dtrue>, (unathorized HTML code
display)
=20
or maybe there is another way I could do this than using 'net/http'??

Try this:

require 'net/http'
USER=3D"user"
PASS=3D"pass"
server =3D Net::HTTP.new(<server ip>,80)
resp, data =3D server.get2("/evscript?runcmd=3Dstart",'Authorization'=3D>'B=
asic
' + ["#{USER}:#{PASS}"].pack('m').strip)
=20

Regards,
Rimantas
--=20
http://rimantas.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top