mIRC Home    About    Download    Register    News    Help

Print Thread
#167404 23/12/06 03:50 PM
Joined: Dec 2006
Posts: 31
Y
yetti Offline OP
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Dec 2006
Posts: 31
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.

yetti #167406 23/12/06 04:04 PM
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
if you could please give the website, what you want returned, and, other useful information, it would be nice smile


-Kurdish_Assass1n
Joined: Dec 2006
Posts: 31
Y
yetti Offline OP
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Dec 2006
Posts: 31
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?

Last edited by yetti; 23/12/06 05:25 PM.
yetti #167412 23/12/06 06:27 PM
Joined: Jan 2004
Posts: 162
R
RRX Offline
Vogon poet
Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
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

RRX #167419 23/12/06 07:45 PM
Joined: Dec 2006
Posts: 31
Y
yetti Offline OP
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Dec 2006
Posts: 31
yep.. google didnt helped me that much smile

(i hope in at most 10 days it will be sorted out :P)

yetti #167441 24/12/06 11:45 AM
Joined: Dec 2006
Posts: 31
Y
yetti Offline OP
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Dec 2006
Posts: 31
well.. I got it smile

thanks everyone for your help

yetti #168930 16/01/07 11:54 PM
Joined: Jan 2007
Posts: 16
C
Pikka bird
Offline
Pikka bird
C
Joined: Jan 2007
Posts: 16
Could I get some help for the same thing for urbandictionary.com or a link towards an existant one?

Thanks for any help

yetti #169038 18/01/07 12:46 PM
Joined: Jan 2007
Posts: 16
C
Pikka bird
Offline
Pikka bird
C
Joined: Jan 2007
Posts: 16
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 
}

yetti #169067 18/01/07 08:50 PM
Joined: Jan 2007
Posts: 16
C
Pikka bird
Offline
Pikka bird
C
Joined: Jan 2007
Posts: 16
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...


Link Copied to Clipboard