|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
Change echo to msg, changed the if tests to ignore empty lines instead of sending a - sign. Do enable floodprotection, because 2 requests will get you killed from the server. while (($sockbr) && (!$sockerr)) {
if (%bot == $null) sockmark $sockname 1
elseif ($sock($sockname).mark) [color:blue]msg[/color] %untarget %bot
sockread %bot
}
|
|
|
|
Joined: Aug 2005
Posts: 32
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 32 |
Here is my current code: on *:text:!sabdetails*:*: {
set %un $2
set %untarget $target
sockopen bot 192.168.1.2 6080
}
alias bot sockopen bot 192.168.1.2 6080
on *:sockopen:bot: {
sockwrite -n bot GET /s3h/getdetails.php?name= $+ %un HTTP/1.1
sockwrite -n bot Host: 192.168.1.2
sockwrite -n bot User-Agent: Omg dont block this T_T I love you!!!! :P
sockwrite -n bot $str($crlf,2)
}
on 1:sockread:bot: {
if ($sockerr > 0) return
sockread %bot
while (($sockbr) && (!$sockerr)) {
if ($sock($sockname).mark) msg %untarget $iif(%bot != $null,%bot,-)
elseif (%bot == $null) sockmark $sockname 1
sockread %bot
}
} I sometimes get these as well: * /sockopen: 'bot' socket in use (line 4, sabreport.mrc) Is that because i need flood protection? Or is it because i need to close the socket? And how do it? :S
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Replace line 4 with..
if (!$sock(bot)) sockopen bot 192.168.1.2 6080
-Andy
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
You can only do one request at a time with this script. You do not need to close the socket normally, it should happen automatically once the entire page is transmitted.
Add this as second line so that you can see (echo -> only you see it) when a request is done when a previous was still underway. The floodprotection is needed because of the amount of data, you can normally send about once message each second (or 2) without being flooded off, if you type more/faster, the server might kick you for flooding. This can happen because of one long page, or many shorter pages, or a short page + very active chatting, or ...
if ($sock(bot)) { echo $target Request denied, previous entry not finished yet. | return }
|
|
|
|
Joined: Aug 2005
Posts: 32
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 32 |
Thanks for that, that is solved, but when someone puts in a nonexistant user, the PHP file gives this: --- Sorry, no details for Nonexistantuser --- But the IRC Script isn't sending that? How would i get it to send those? :P
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
If you can edit the PHP script: send a line break after that line.
Now I'm wondering, do you get ALL output when the user exists? Or is the last line missing too? If that's the case, it's because /sockread %bot only reads a line if it ends in $crlf. If there's no line break, nothing is read... Use /sockread -f %bot to force the read, even if it doesn't end in a line break. This might give partial lines sometimes (a line split over 2 lines), but everything should be displayed...
|
|
|
|
Joined: Aug 2005
Posts: 32
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 32 |
Thanks for that Kelder! :P Yes the last line wasn't coming through on the existant user search, but i just added a line break after it. Same with the non existant user, because that's easier, and quicker, and results in no down time! :P
Thanls for all your help everyone.
|
|
|
|
|
|