mIRC Home    About    Download    Register    News    Help

Print Thread
#10842 13/02/03 01:54 AM
Joined: Feb 2003
Posts: 83
L
LO_KEY Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
im making a covers search addon for mIRC, and the site im gettin the covers from, makes u select the title from a list, then select the front or back cover , then push download cover.

Any help on how todo this thru mIRC would be greatly appreciated. laugh


any help would make me happy
#10843 13/02/03 06:29 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
What you are wanting to do is, in theory, not terribly difficult. However, it does require a fairly thorough knowledge of how HTTP works, specifically with how <form action="pagename" method="[GET|POST]"> is handled.

With method="GET", the data that the page is sent to (action="pagename") is URLEncoded and attached to the end of the URL itself. Most search engines use this method and you have horribly long URLs, but they are paste-able/save-able.

With method="POST", the data is sent in the body of the request, hidden from view (prettier for the end user, but not paste-able or save-able). What happens in this case is that the browser (which you will have to emulate in your script) sends back the HTTP headers for the page, followed by a single blank line, followed by the data pairs (controlname=value). Some forms use <input type="HIDDEN" name="SomeName" value="Some value">, and you have to correctly send back that information. Additionally, if the page/site you're working from uses cookies, you'll have to correctly send back the cookie data.

When you initially set up the socket to that site, some sites require that you send Connection: Keep-alive; if the site/page requires it so you maintain a session on the server.
Code:

&lt;FORM action="http://www.mysite.com/pagename.php" method="POST"&gt;
  First Name: &lt;INPUT type="text" name="FirstName"&gt;&lt;br /&gt;
  Middle Name: &lt;INPUT type="text" name="MiddleName"&gt;&lt;br /&gt;
  Last Name: &lt;INPUT type="text" name="LastName"&gt;&lt;br /&gt;
  &lt;INPUT type="submit" value="OK"&gt;&lt;br /&gt;
  &lt;INPUT type="hidden" name="LoggedIn" value="True"&gt;
&lt;/form&gt;
  • Method="GET"
    http[/b]://www.mysite.com/pagename.php?FirstName=John&MiddleName=Q.&LastName=Public&LoggedIn=True
  • Method="POST"
    POST http[/b]://www.mysite.com/pagename.php HTTP/1.1
    Accept: text/html, image/gif, image/jpeg, */*
    User-Agent: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0b; Win32)
    Pragma: no-cache
    Content-type: application/x-www-form-urlencoded
    Content-length: 58

    FirstName=John&MiddleName=Q.&LastName=Public&LoggedIn=True
Your challenge will be to decode the <FORM> that's being submitted to that page. Then all you have to do is send back the correct headers (including cookie content, if any) in the correct format and then deal with the data that comes back to you from the server.

RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard