mIRC Home    About    Download    Register    News    Help

Print Thread
#101717 27/10/04 08:54 AM
Joined: Dec 2002
Posts: 60
C
coder Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2002
Posts: 60
hye
im making new socket that can read data from site
but the problem is,the site provide me username & passwd to able reading the contens
so how do i make my socket sending the username&passwd and continue reading the information in the site

#101718 27/10/04 11:52 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Include this line in your HTTP request:

sockwrite -n $sockname Authorization: Basic $encode(username:password ,m)

Change the blue parts to your actual username and password. Leave the colons there as a separator.

Note that you don't need to "continue" and make a second request if you provide the auth info in the first request.

#101719 28/10/04 09:31 AM
Joined: Dec 2002
Posts: 60
C
coder Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2002
Posts: 60
Code:
  
on *:SOCKOPEN:web: { 
  sockwrite -n $sockname Authorization: Basic $encode(myid:mypass ,m)  
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname Host: www.somesite.com $+ $str($crlf ,2)
 sockwrite -n $sockname Connection: keep-alive
   sockwrite -n $sockname $crlf

}


the sockread return
Your browser sent a request that this server could not understand.

#101720 28/10/04 04:11 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Code:
On *:sockopen:web: {
  [color:blue]sockwrite -n $sockname GET /path/to/page.html HTTP/1.0[/color]
  sockwrite -n $sockname Authorization: Basic $encode(myid:mypass ,m)
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname Host: www.somesite.com
  sockwrite -n $sockname
}


Link Copied to Clipboard