mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
i cannot get mirc to receive the content of this page, i only get the header. what am i doing wrong?

Code:
on 1:sockopen:IOS:{
  sockwrite -n $sockname GET /IOS/ $+ %IOS.request HTTP/1.0
  sockwrite -n $sockname User-Agent: IOS 1.0/mIRC $version
  sockwrite -n $sockname Host: www.host.com $+ $crlf $+ $crlf 
}
on 1:sockread:IOS:{
  if ($sockerr) { echo -a IOS Socket Error. | halt }
  else {
    sockread %temp
    echo -a : %temp
  }
  unset %IOS.request
}

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
I usually just do:
Code:
on *:sockopen:name:{
  var %swrite = sockwrite -n $sockname

  %swrite GET /path/to/page.php HTTP/1.0
  %swrite Host: sub.domain.com
  %swrite User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
  %swrite
}

on *:sockread:name:{
  if ($sockerr) { return }
  var %s | sockread %s

  while ($sockbr) {
    echo -a : %s
    sockread %s
  }
}

Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
that is just returning the header

Code:
: HTTP/1.0 200 OK
: Date: Thu, 19 Mar 2009 00:01:28 GMT
: Server: Apache/2.2.11 (Unix) mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.8 mod_perl/2.0.4 Perl/v5.8.8
: X-Powered-By: PHP/5.2.8
: Cache-Control: max-age=1
: Expires: Thu, 19 Mar 2009 00:01:29 GMT
: Vary: Accept-Encoding,User-Agent
: Content-Length: 2
: Content-Type: text/html
: X-Cache: MISS from sv27.byethost27.org
: X-Cache-Lookup: MISS from sv27.byethost27.org:80
: Via: 1.1 sv27.byethost27.org:80 (squid/2.7.STABLE6-20090214)
: Connection: close
:

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Content-Length: 2
: Content-Type: text/html


A 2 byte text file? Try accessing a file with some data in it.

Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
i need that message. its a status message for the results of the GET request. i gotta have it.

Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
by writeing the entire thing to a file i can get what i want but now i need to find out how to strip or remove the header from the text file. does any one have an idea for that?

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Try this:

Code:

alias IOS {
  var %host = www.google.ca
  var %req = index.html
  ;
  if ($sock(IOS)) sockclose IOS
  sockopen IOS %host 80
  sockmark IOS %host %req
}

on *:SOCKOPEN:IOS:{
  sockwrite -n IOS GET /IOS/ $+ $gettok($sock(IOS).mark,2,32) HTTP/1.0
  sockwrite -n IOS Host: $gettok($sock(IOS).mark,1,32)
  sockwrite -n IOS $crlf
  sockmark IOS $false
}
on *:SOCKREAD:IOS:{
  var %s
  sockread %s
  if ($sock(IOS).mark == $false) {
    if (%s == $null) sockmark IOS $true
    return
  }   
  else {
    echo -a $+(4,>,3,%s)
  } 
}



-genius_at_work

Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
thanks:)


Link Copied to Clipboard