DiZuM Posted March 13, 2007 Share Posted March 13, 2007 Ok... This is what i wrote. I know what is wrong, so can u tell me what is missed socket? Ok this is it: on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$mta.getid($1,$4)),$2) if ($3 == !lookup) { if (%a == -1) mta.msg $1 $2 Error - Absent ID else my.trace $1 %a } } alias my.trace { set %my.trace $1 $2 if (!$sock(my.trace $+ $mta.ip($1,$2))) sockopen my.trace $+ $mta.ip($1,$2) http://www.api.hostip.info 80 } on *:SOCKOPEN:my.trace*:{ tokenize 32 %my.trace if ($sockerr > 0) { sockclose $sockname mta.text $1 Trace: An error has occured. (socket error) } else { sockwrite -n $sockname GET /get_html.php?ip= $+ $mta.ip($1,$2) $+ &display=whois HTTP/1.1 sockwrite -n $sockname Host: http://www.api.hostip.info sockwrite -n $sockname Connection: keep-alive sockwrite $sockname $crlf } } on *:SOCKCLOSE:my.trace*:{ unset %my.trace } on *:SOCKREAD:my.trace*:{ var %t sockread %t if (Country: isin %trace) { tokenize 32 %my.trace mta.text $1 $mta.nick($1,$2) - Country: $gettok(%t,2-,58) - City: $gettok(%t,2-,58) sockclose $sockname } } I know this is wrong: Country: $gettok(%t,2-,58) - City: $gettok(%t,2-,58) so can u tell me what is right word there? Plz, help me =) Link to comment
lil Toady Posted March 13, 2007 Share Posted March 13, 2007 cant help you if http://www.api.hostip.info doesnt work P.S: City 90% of times will be returned incorrect. I've already tried that. There is no such ip db that'd know that stuff that good. If you did that only for the City, you can get it through my default trace host too Link to comment
DiZuM Posted March 14, 2007 Author Share Posted March 14, 2007 This works; http://api.hostip.info/get_html.php?ip=84.249.8.112 whit www. it wont works, i dont know why... But can you tell me solution how get it working? ty. Link to comment
lil Toady Posted March 14, 2007 Share Posted March 14, 2007 on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$mta.getid($1,$4)),$2) if ($3 == !lookup) { if (%a == -1) mta.msg $1 $2 Error - Absent ID else my.trace $1 %a } } alias my.trace { set %my.trace $1 $2 if (!$sock(my.trace $+ $mta.ip($1,$2))) sockopen my.trace $+ $mta.ip($1,$2) api.hostip.info 80 } on *:SOCKOPEN:my.trace*:{ tokenize 32 %my.trace if ($sockerr > 0) { sockclose $sockname mta.text $1 Trace: An error has occured. (socket error) } else { sockwrite -n $sockname GET /get_html.php?ip= $+ $mta.ip($1,$2) $+ &display=whois HTTP/1.1 sockwrite -n $sockname Host: api.hostip.info sockwrite -n $sockname Connection: keep-alive sockwrite $sockname $crlf } } on *:SOCKCLOSE:my.trace*:{ unset %my.trace tokenize 32 %my.trace mta.text $1 $mta.nick($1,$2) - Country: $gettok(%my.trace.r,1,32) $+ , City: $gettok(%my.trace.r,2,32) } on *:SOCKREAD:my.trace*:{ var %t sockread %t if (Country isin %t) { set %my.trace.r $iif(Unknown isin %t,Unknown,$gettok(%t,2-,32)) } elseif (City isin %t) { set %my.trace.r %my.trace.r $iif(Unknown isin %t,Unknown,$gettok(%t,2-,32)) sockclose $sockname } } Link to comment
Recommended Posts