mIRC Home    About    Download    Register    News    Help

Print Thread
#71875 18/02/04 08:27 AM
Joined: Oct 2003
Posts: 11
D
d0h Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Oct 2003
Posts: 11
hi there laugh,
i've recently read a tutorial on sockets in mircscripts.org.. it teaches the basics of downloading the html file and storing it on your own computer.. but i have a question..
is it possible to use sockets to select a checkbox and then "click" the ok button.. hence sending some info back to the server?

thanks!

#71876 18/02/04 08:46 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
The checkbox you're talking about is a web form. See this post for an example of using sockets to send forms.

#71877 18/02/04 08:48 AM
Joined: Oct 2003
Posts: 11
D
d0h Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Oct 2003
Posts: 11
ahh i think thats it XD
thanks a lot! i'll post back here again if i need help laugh

#71878 18/02/04 12:45 PM
Joined: Oct 2003
Posts: 11
D
d0h Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Oct 2003
Posts: 11
umm ok..sending the form works well... but im trying to fill in a form in a website where logging in is required
i managed to log in using sockets... but as the form is timed, it may not be there when i just log in... and it seems that if i use a timer to fill in the form, the connection is lost and i get logged out

i noticed that theres this line in the script..
sockwrite -n $sockname Connection: close

does this mean that everytime the socket goes idle, the connection to the website closes? how do i remain logged in? the server uses php sessions and my session id will change each time a new connection is made.. so thats probably why i cant stay logged in..

#71879 19/02/04 02:13 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Quote:
does this mean that everytime the socket goes idle, the connection to the website closes?

The header 'Connection: close' tells the server to close the connection once it has finished sending you the file you've requested. This was the default behavior of HTTP/1.0, but HTTP/1.1 allows you to specitfy a 'Connection: Keep-Alive' that tells the server to leave the connection open for some time (usually a few seconds) so you can send further HTTP requests. This helps to speed up the retrieval of websites, because you can request everything (images, CSS, scripts) through one connection and don't have to open a separate connection for every file.


Quote:
how do i remain logged in?

I'm afraid I can't tell you how until I see how the server works. If you can't publicize its address or login details for privacy reasons, can you please specify in more detail what you're sending, and what the serve replies are?

#71880 19/02/04 01:53 PM
Joined: Oct 2003
Posts: 11
D
d0h Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Oct 2003
Posts: 11
hmm.. i went to the quakenet #scripting for some help... someone told me to use
connection: keep-alive
keep-alive: 600

i did but the header of the file i retrieved still showed "connection: close"

well... the site is really a game site XD
i'll pm you the site url grin

#71881 20/02/04 02:55 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Ok this one is very simple. In reply to your POST login request, the server sends the following header:
  • Set-Cookie: PHPSESSID=003097381080538829c6c43aab7c7651; path=/
All you need is to store the value of this cookie and send it with further HTTP requests. For example,
  • sockwrite -n $sockname GET / HTTP/1.0
    sockwrite -n $sockname Host: www.[/b]xxxx-xxxxxx.org
    sockwrite -n $sockname Cookie: PHPSESSID=003097381080538829c6c43aab7c7651
    sockwrite -n $sockname
If you do send the cookie, the server will send back the logged-in users page. And if you don't send it, you will get the default login page. Try it yourself laugh

#71882 21/02/04 04:29 AM
Joined: Oct 2003
Posts: 11
D
d0h Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Oct 2003
Posts: 11
THANKS! XD

but i'm just about to go out now, will try it later

thanks again! grin


Link Copied to Clipboard