mIRC Homepage
Posted By: yetti Socket Script - 23/12/06 03:50 PM
Hello

I am not to good at scripting, and I dont know much about socket scripting. That's why I need help...

Basicly I need a script that will connect to a website, use the search, and return the answer to me.

if anyone cand help me.. I would apreciate it.
Posted By: Kurdish_Assass1n Re: Socket Script - 23/12/06 04:04 PM
if you could please give the website, what you want returned, and, other useful information, it would be nice smile
Posted By: yetti Re: Socket Script - 23/12/06 04:34 PM
sorry.. i didnt knew if it was possbile.

I want to be able to send an IP to www.ripe.net , do the search and then to echo the result.

If the Ip is for ex: 123.456.789.123, then I will have to get the content of this page:

http://www.ripe.net/fcgi-bin/whois?form_...123.456.789.123


EDIT:
someone helped me to get a code that returns the content of the page, but it's the whole page. how do I parse it so that it returns only a few lines.. and not all the page?


EDIT:
example:
I have a code that retreives the full content of this page:
http://www.ripe.net/fcgi-bin/whois?form_...ext=81.81.81.81
Code:
on *:SOCKREAD:ripe: {
  :read
  sockread %in
  if (%in) { echo -s %in }
  if ($sockbr) { goto read }
}


that is the whole page.

how do I parse only what I need ( listed below from example IP 81.81.81.81):
Quote:

org: ORG-WTS1-RIPE
netname: IT-WIND-CST-20020410
descr: WIND Telecomunicazioni S.p.A.
descr: PROVIDER
country: IT
organisation: ORG-WTS1-RIPE
org-name: WIND Telecomunicazioni S.p.A.
org-type: LIR
address: WIND Telecomunicazioni S.p.A.
Via C.G. Viola 48 c.a.p.
00148 Rome
Italy


this is all the info I want from that page.

can anyone help?
Posted By: RRX Re: Socket Script - 23/12/06 06:27 PM
Quote:

20061223-174824 <yetti> now I will spend 10 days figuring out how to parse that page

10 days? lol, you even didnt try it for an hour :P
Posted By: yetti Re: Socket Script - 23/12/06 07:45 PM
yep.. google didnt helped me that much smile

(i hope in at most 10 days it will be sorted out :P)
Posted By: yetti Re: Socket Script - 24/12/06 11:45 AM
well.. I got it smile

thanks everyone for your help
Posted By: chili_beta Re: Socket Script - 16/01/07 11:54 PM
Could I get some help for the same thing for urbandictionary.com or a link towards an existant one?

Thanks for any help
Posted By: chili_beta Re: Socket Script - 18/01/07 12:46 PM
I found this while searching, but can't make it work...

Help please?

Code:
on *:TEXT:!slango*:#:{ 
  if (!$istok(nicknames allowed to enable/disable space separated,$nick,32)) return 
  if ($1 == !slangoff) .disable slang 
  elseif ($1 == !slangon) .enable slang 
} 
#slang on 
on *:TEXT:!slang *:#:{ 
  urbandic $chan $2- 
} 
#slang end

alias urbandic { 
  var %sock = $+(urbandic,$1) 
  if ($sock(%sock)) return 
  sockopen %sock www.<b style="color:black;background-color:#a0ffff">urbandictionary</b>.com 80 
  sockmark %sock 1 $1 $urlencode($2-) 
} 
on *:SOCKOPEN:urbandic*:{ 
  var %a = sockwrite -n $sockname 
  %a GET $+(/define.php?term=,$getmark($sockname,3-)) <b style="color:black;background-color:#99ff99">HTTP</b>/1.1 
  %a Host: www.<b style="color:black;background-color:#a0ffff">urbandictionary</b>.com 
  %a Connection: close 
  %a $crlf 
} 
on *:<b style="color:black;background-color:#ffff66">SOCKREAD</b>:urbandic*:{ 
  var %temp 
  <b style="color:black;background-color:#ffff66">sockread</b> %temp 
  if ($regex(%temp,<h1><b>(.+)</b> is undefined\.</h1>)) $& 
    msg $getmark($sockname,2) $+(",$regml(1),") is undefined 
  if ($regex(%temp,<p>(.+))) { 
    if ($getmark($sockname,1) <= $MAX_URBAN_SENDS) $& 
      msg  $getmark($sockname,2) No. $getmark($sockname,1) : $+($htmlfree($regml(1)),$iif(*</p> !iswm $regml(1),...)) 
    sockmark $sockname $calc($getmark($sockname,1) + 1) $getmark($sockname,2-) 
  } 
} 
alias -l getmark return $gettok($sock($1).mark,$$2,32) 

alias -l urlencode { 
  var %a = $regsubex($$1,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2))) 
  return $replace(%a,$chr(32),$chr(43)) 
} 

alias -l htmlfree { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&,$chr(9)) 
  return %x 
}
Posted By: chili_beta Re: Socket Script - 18/01/07 08:50 PM
found 2 other ones ( here and here)

With the two of them I get a "* urban opened." message and with the first one "Definition for: (word)" but no definition...
© mIRC Discussion Forums