mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 16
S
saxorr Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Oct 2005
Posts: 16
Hey there,

I'm trying to fetch info from a competition website, but all the sockopen command returning from the site is the header..and that's all..

Here's the page I want to fetch the info from:
http://lastladder.ogn.com.au/index.php?name=Competition&op=compView&event=45

and my code..
Code:
alias ogn {
  sockopen ogn lastladder.ogn.com.au 80
}

on *:sockopen:ogn: {
  .sockwrite -n $sockname GET /index.php?name=Competition&op=compView&event=45 HTTP/1.1
  .sockwrite -n $sockname Host: lastladder.ogn.com.au $+ $crlf $+ $crlf  
}

on 1:sockread:ogn: {
  if ($sockerr > 0) return  
  :prossimo  
  sockread %riposte  
  if ($sockbr == 0) return  
  if (%riposte == $null) {     
    %riposte = $str(-,16) 
  } 
  /echo -a %riposte  
  goto prossimo
} 


I really don't know why it's doing this, but if anyone can help me on it, it'll be greatly appreciated.

Thanks in advance

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Add these two headers:


Accept-Encoding: text/html
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)


First one, because you would receive gzip data, so we want to have text/html instead.
Second, because this site doesn't accept connections from entities not identified as browsers.

Couldn't hurt to always add the header:

Connection: close

Normally the server will close the connection itsself, but I've had occasions where this doesn't happen, so adding it is always a good thing.


Gone.
Joined: Oct 2005
Posts: 16
S
saxorr Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Oct 2005
Posts: 16
Hey thanks, that worked like a charm laugh

Thanks again


Link Copied to Clipboard