mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Geting a webpage's data #129178 03/09/05 03:10 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
Hello, i'm a n00b to this programming language! :tongue: I mainly program in PHP. I can create a PHP script that can get data from a mySQL database on request and display it for an IRC bot to read the data from. I was wondering how can i get the IRC bot to goto an address like http://localhost:6080/s3h/getdetails.php?requestedusername

requestedusername is what the IRC user who puts in !data requestedusername has specified as a user. If that makes sense, i can program the PHP code to display the data in Tables or just a list on a simple page and it will display something like this:

Username Details: requestedusername
Generated: <<TIME>>
Invisibility Shields: xxx
Black Powder Missiles: xxx

e.t.c. the weapons keep going on (there is around 36 from memory)

But how would i get the "xxx" details from it to display what weapons of each type have been damaged? :P If that makes sense, all i need to know is how to get data from a page, and what would be the best way to setout the page! xD

Re: Geting a webpage's data #129179 03/09/05 04:05 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I have no idea if this works dude, don't have the files and such. So, you'll have to test it and come back with any results.. smile

Code:
alias lh {
  %un = $$1
  sockopen lh localhost 6080
}

on *:sockopen:lh: { 
  sockwrite -n $sockname GET $+(/s3h/getdetails.php?,%un) HTTP/1.1 
  sockwrite -n $sockname Host: $+(localhost,$crlf,$crlf)
}

on 1:sockread:lh: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %lh
  if ($sockbr == 0) return
  if (%lh == $null) %lh = -
  if (Generated* iswm %lh) return
  if (: isin %lh) echo -a $gettok(%lh,2,58)
  goto nextread
}


-Andy

Re: Geting a webpage's data #129180 03/09/05 04:06 AM
Joined: Sep 2004
Posts: 200
I
IR_n00b Offline
Fjord artisan
Offline
Fjord artisan
I
Joined: Sep 2004
Posts: 200
/help sockets

thats about all you need, also http headers for firefox is usefull as well, to see what firefox sent the server (the webpage) it. smirk

Re: Geting a webpage's data #129181 03/09/05 05:26 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
I have modified the coding a little, basically just the URL of:

Code:
alias lh {
  %un = $$1
  sockopen lh localhost 6080
}

on *:sockopen:lh: { 
  sockwrite -n $sockname GET $+(/s3h/getdetails.php?name=,%un) HTTP/1.1 
  sockwrite -n $sockname Host: $+(localhost,$crlf,$crlf)
}

on 1:sockread:lh: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %lh
  if ($sockbr == 0) return
  if (%lh == $null) %lh = -
  if (Generated* iswm %lh) return
  if (: isin %lh) echo -a $gettok(%lh,2,58)
  goto nextread
}


I have made the file that outputs the data like this (if you look at the source code, if you view it with IE or a browser it's just 1 continous line:

Quote:
--- Sabotage Details of rshield ---
Blackpowder Missiles: 0, Invisibility Shields: 0
Excaliburs: 0, Battle Axes: 0, Dragons: 0, Flaming Arrows: 0, Dragonskins: 0
Steeds: 0, Hammers of Thor: 0, Wargs: 0
Mithrils: 0, Gauntlets: 0, Heavy Shields: 0, Elven Cloaks: 0
Broadswords: 0, Warhammers: 0, Warblades: 0, Steel Bows: 0, Plate Armors: 0
Lances: 0, Maces: 0, Spears: 0, Longbows: 0, Chainmails: 0
Long Sword: 0, Pikes: 1, Clubs: 0, Crossbows: 0, Shields: 0
Staves: 0, Hatchets: 0, Slings: 0, Short Bows: 0
Helmets: 0, Knives: , Sticks: 0
--- Powered By Hawk Works ---


Now i'm a total n00b and i'd like to test it straight away! :P I've been Working on Hawk Works for ages. So how would i get the code above to react on !sabdetails <<requestedname>> then it goes to http://localhost:6080/s3h/getdetails.php?name=<<requestedname>> then gets the details and messages it back to the Channel Window? I don't really care if the script grabs the data straight away and messages it or if it saves the data to a text file somewhere and then opens the file, reading line by line the message and sending it! :P

If you have no idea how to do the above, how would you grab data from a text file and read it line by line and messaging it? Because if i open a socket connection with that page and then get the PHP script to write it to a file it might be easier coding.

Re: Geting a webpage's data #129182 03/09/05 03:00 PM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
Since i can't edit my last post here is what i've gotten up to:

Code:
on *:text:!sabdetails*:* {
 %un = $2
 /sockopen bot http://localhost:6080 6080
} 

on *:sockopen:bot: { 
  sockwrite -n $sockname GET /s3h/getdetails.php?name=,%un 
  sockwrite -n $sockname Host: http://localhost:6080 
  sockwrite -n $sockname User-Agent: $version 
  sockwrite -n $sockname $crlf 
} 

on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  if (Generated* iswm %bot) return
  if (: isin %bot) echo -a $gettok(%bot,2,58)
  goto nextread
}


But it doesn't work, yet it doesn't return any errors! When a user puts in !sabdetails rshield for example! blush

Can i get some help please? BTW the PHP script is outputting the data just like a notepad file with new lines in each, just if loaded in Internet Explorer, it comes up as one line.

Re: Geting a webpage's data #129183 03/09/05 08:34 PM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Don't edit your previous post, about everything you changed since then is wrong...
red = wrong, green = good, blue = comment

Code:
on *:text:!sabdetails*:* {
  %un = [color:green]$2[/color]
  [color:red]/[/color]sockopen bot [color:red]http://localhost:6080[/color] 6080
  [color:blue]; above is not an ip or named address, it's a HTTP request
  ;the slash isn't needed in a script[/color]
} 

on *:sockopen:bot: { 
  sockwrite -n $sockname GET [color:red]/s3h/getdetails.php?name=,%un [/color]
  [color:blue]; The previous snippet appended the contents of %un using $+, this code
  ; really sends that url, %un will just be percent u n[/color]
  sockwrite -n $sockname Host: [color:red]http://localhost:6080 [/color]
  [color:blue]; again, this is not a host, it's a http request[/color]
  [color:red]sockwrite -n $sockname User-Agent: $version[/color]
  [color:blue]; not needed[/color]
  sockwrite -n $sockname [color:red]$crlf [/color]
  [color:blue]; you really need 2 $crlf's right after another, only one means
  ; the server will wait a few seconds/minutes for the end of the request that is never sent[/color]
} 
[color:blue]; rest omitted[/color]

Re: Geting a webpage's data #129184 04/09/05 01:36 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
OK here is what i've got fixing the errors and stuff:

Code:
on *:text:!sabdetails*:* {
 %un = $2
 sockopen bot 192.168.1.2 6080
} 

on *:sockopen:bot: { 
  sockwrite -n $sockname GET $+(/s3h/getdetails.php?name=,%un)
  sockwrite -n $sockname Host: $+(192.168.1.2,$crlf,$crlf)
} 

on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  if (Generated* iswm %bot) return
  if (: isin %bot) echo -a $gettok(%bot,2,58)
  goto nextread
}


Just a question, is that going to the url http://192.168.1.2:6080/s3h/getdetails.php?name=%un
Where $un is the second word after !sabdetails ? My web server only runs on port 6080 because port 80 is blocked by my ISP to stop hacking attempts.

Anyway, here is what i did in another IRC window:

Quote:
[11:19:54] *** Initial topic:
[11:19:54] *** #alien: r_alien- ~alien-
[11:19:58] alien-: r_alien- has just arrived! r_alien- is the Owner of this bot.
[11:19:58] *** Mode change "+v r_alien-" for channel #alien by alien-.
[11:20:00] *** #alien was created on Sun Sep 04 01:03:27 2005.
[11:20:39] r_alien-: !shutdown
[11:20:56] *** alien- has joined #alien.
[11:20:58] *** Mode change "+qo alien- alien-" for channel #alien by ChanServ.
[11:22:28] r_alien-: !sabdetails rshield
[11:30:06] r_alien-: !shutdown
[11:30:07] *** alien- has signed off IRC (Quit: Alien IRC Bot 1.0 based on YBBot> You cannot get this bot frown May i interest you in Hawk Works instead at http://220.237.150.18:6080/s3h/).
[11:30:19] *** alien- has joined #alien.
[11:30:21] *** Mode change "+qo alien- alien-" for channel #alien by ChanServ.
[11:31:02] r_alien-: !sabdetails rshield


When i typed the !shutdown commands the bot exits and i save the code and reload mIRC. Anway, i typed !sabdetails rshield and nothing comes up! Nothing in the window, and nothing in the mIRC connection window saying there is an error! >.< I programmed the PHP script to write to a log file just quickly to tell me when it ran, i typed the !sabdetails rshield command again, and nothing showed up in the log, which means that the PHP file wasn't executed! The log file would have recieved an extra line even if the name= parameter wasn't filled! frown

Re: Geting a webpage's data #129185 04/09/05 01:51 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
we cannot connect to your server to test this

but you might change the sockread to be more "generic" so that you are only changing one thing at a time

Code:
on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}


when you have that working then you can tweak the output with a $remove() or whatever

Re: Geting a webpage's data #129186 04/09/05 02:29 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
I tried that code, and still nothing! blush So what i've done is opened up that script to the world, the PHP coding used t check to make sure the IP was only one IP (192.168.1.2), but i've removed that for now.

The script can be found at:

http://220.237.150.18:6080/s3h/getdetails.php?name=rshield

That will give you what people have sabbed from me! Here is a non existant one record:

http://220.237.150.18:6080/s3h/getdetails.php?name=nonexistantname

Re: Geting a webpage's data #129187 04/09/05 02:53 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Code:
alias bot sockopen bot 220.237.150.18 6080
on *:sockopen:bot: { 
  sockwrite -n bot GET http://220.237.150.18:6080/s3h/getdetails.php?name=rshield 
} 

on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}

I used the above and connected, here is the output:
[quote]
--- Sabotage Details of rshield ---
Blackpowder Missiles: 0, Invisibility Shields: 0
Excaliburs: 0, Battle Axes: 0, Dragons: 0, Flaming Arrows: 0, Dragonskins: 0
Steeds: 0, Hammers of Thor: 0, Wargs: 0
Mithrils: 0, Gauntlets: 0, Heavy Shields: 0, Elven Cloaks: 0
Broadswords: 0, Warhammers: 0, Warblades: 0, Steel Bows: 0, Plate Armors: 0
Lances: 0, Maces: 0, Spears: 0, Longbows: 0, Chainmails: 0
Long Sword: 0, Pikes: 1, Clubs: 0, Crossbows: 0, Shields: 0
Staves: 0, Hatchets: 0, Slings: 0, Short Bows: 0
Helmets: 0, Knives: 0, Sticks: 0
[quote]

Re: Geting a webpage's data #129188 04/09/05 03:04 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
I put your code in so it looks like this and still no message popped up in the window.

Code:
on *:text:!sabdetails*:* {
 %un = $2
 sockopen bot 220.237.150.18 6080
} 

;on *:sockopen:bot: { 
;  sockwrite -n $sockname GET $+(/s3h/getdetails.php?name=,%un)
;  sockwrite -n $sockname Host: $+(192.168.1.2,$crlf,$crlf)
;} 

alias bot sockopen bot 220.237.150.18 6080
on *:sockopen:bot: { 
  sockwrite -n bot GET http://220.237.150.18:6080/s3h/getdetails.php?name=rshield 
} 

on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}
}


Just two questions here, how can i get !sabdetails <<a username>> to trigger it and then the URL is http://220.237.150.18:6080/s3h/getdetails.php?name=<<a username>>

Well that link is for you anyway, i'll change the IP address to internal IP's later. And why doesn't my above code work! *cries* confused

Last edited by r_alien; 04/09/05 03:06 AM.
Re: Geting a webpage's data #129189 04/09/05 03:19 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
on *:text:!sabdetails*:*: {
%un = $2
sockopen bot 220.237.150.18 6080
}


you left off a :

Re: Geting a webpage's data #129190 04/09/05 03:26 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
here is what I just tested
Code:
on *:text:!sabdetails*:*: {
  set %un $2
  set %chan $chan
  sockopen bot 220.237.150.18 6080
} 

alias bot sockopen bot 220.237.150.18 6080
on *:sockopen:bot: { 
  sockwrite -n bot GET http://220.237.150.18:6080/s3h/getdetails.php?name= $+ %un
} 

on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  msg %chan %bot
  goto nextread
}

and the channel output
Quote:

<buzz44> !sabdetails rshield
<MikeChat> --- Sabotage Details of rshield ---
<MikeChat> Blackpowder Missiles: 0, Invisibility Shields: 0
<MikeChat> Excaliburs: 0, Battle Axes: 0, Dragons: 0, Flaming Arrows: 0, Dragonskins: 0
<MikeChat> Steeds: 0, Hammers of Thor: 0, Wargs: 0
<MikeChat> Mithrils: 0, Gauntlets: 0, Heavy Shields: 0, Elven Cloaks: 0
<MikeChat> Broadswords: 0, Warhammers: 0, Warblades: 0, Steel Bows: 0, Plate Armors: 0
<MikeChat> Lances: 0, Maces: 0, Spears: 0, Longbows: 0, Chainmails: 0
<MikeChat> Long Sword: 0, Pikes: 1, Clubs: 0, Crossbows: 0, Shields: 0
<MikeChat> Staves: 0, Hatchets: 0, Slings: 0, Short Bows: 0
<MikeChat> Helmets: 0, Knives: 0, Sticks: 0

Re: Geting a webpage's data #129191 04/09/05 03:32 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
I still have nothing! blush

Code:
on *:text:!sabdetails*:*: {
 %un = $2
 sockopen bot 192.168.1.2 6080
} 

;on *:sockopen:bot: { 
;  sockwrite -n $sockname GET $+(/s3h/getdetails.php?name=,%un)
;  sockwrite -n $sockname Host: $+(192.168.1.2,$crlf,$crlf)
;} 

alias bot sockopen bot 192.168.1.2 6080
on *:sockopen:bot: { 
  sockwrite -n bot GET http://192.168.1.2:6080/s3h/getdetails.php?name=rshield 
} 
on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}


Thats my code! xD

Quote:
[13:30:54] *** alien- has joined #alien.
[13:30:56] *** Mode change "+qo alien- alien-" for channel #alien by ChanServ.
[13:31:01] r_alien-: !sabdetails
[13:31:17] r_alien-: !sabdetails rshield


Still nothing confused

Re: Geting a webpage's data #129192 04/09/05 03:45 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Code:
change to  this:
on *:text:!sabdetails*:*: {
 [color:red]set %un  $2[/color]
 sockopen bot 192.168.1.2 6080
} 
[color:blue]
remove this completely
;on *:sockopen:bot: { 
;  sockwrite -n $sockname GET $+(/s3h/getdetails.php?name=,%un)
;  sockwrite -n $sockname Host: $+(192.168.1.2,$crlf,$crlf)
;} [/color]

also change the next red part

on *:sockopen:bot: { 
  sockwrite -n bot GET http://192.168.1.2:6080/s3h/getdetails.php?name=[color:red] $+ %un [/color]
} 
on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}

Re: Geting a webpage's data #129193 04/09/05 05:12 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
Ok i changed the code to:

Code:
on *:text:!sabdetails*:*: {
 set %un $2
 sockopen bot 192.168.1.2 6080
} 

alias bot sockopen bot 192.168.1.2 6080
on *:sockopen:bot: { 
  sockwrite -n bot GET http://192.168.1.2:6080/s3h/getdetails.php?name= $+ %un
} 
on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}


And still nothing! No messages in the channel where it was requested, an no errors in mIRC. frown

Quote:
[15:07:13] *** Initial topic:
[15:07:13] *** #alien: r_alien- ~alien-
[15:07:19] alien-: r_alien- has just arrived! r_alien- is the Owner of this bot.
[15:07:19] *** Mode change "+v r_alien-" for channel #alien by alien-.
[15:07:22] *** #alien was created on Sun Sep 04 14:55:36 2005.
[15:07:30] r_alien-: !shutdown
[15:07:45] *** alien- has joined #alien.
[15:07:47] *** Mode change "+qo alien- alien-" for channel #alien by ChanServ.
[15:08:16] r_alien-: !sabdetails r_alien
[15:08:25] r_alien-: !sabdetails rshield
[15:10:03] r_alien-: !shutdown
[15:10:04] *** alien- has signed off IRC (Quit: Alien IRC Bot 1.0 based on YBBot> You cannot get this bot frown May i interest you in Hawk Works instead at http://220.237.150.18:6080/s3h/).
[15:10:15] *** alien- has joined #alien.
[15:10:17] *** Mode change "+qo alien- alien-" for channel #alien by ChanServ.
[15:10:55] r_alien-: !sabdetails rshield


Any ideas now?

Re: Geting a webpage's data #129194 04/09/05 08:03 AM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Code:
on *:text:!sabdetails*:*: {
 set %un $2
 sockopen bot 192.168.1.2 6080
} 

alias bot sockopen bot 192.168.1.2 6080
; Why this alias? It doesn't set %un, might be ok if it's for testing now and you didn't unset %un.

on *:sockopen:bot: { 
  sockwrite -n bot GET http://192.168.1.2:6080/s3h/getdetails.php?name= $+ %un [color:green]HTTP/1.0
  sockwrite bot $str($crlf,2)[/color]
} 
on 1:sockread:bot: {
  if ($sockerr &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}

If it still doesn't work, download ethereal (or some other sniffer) and find out what your script sends, and what a browser sends. Then find out what the differences are and see if they are preventing the script or not. Not all headers from your browser are necessary, some can even make it more difficult (chunked encoding, deflate, ...)

Re: Geting a webpage's data #129195 04/09/05 08:55 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
OK, i have now modified my script a little. It reads:

Code:
on *:text:!sabdetails*:*: {
 set %un $2
 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 &gt; 0) return
  :nextread
  sockread %bot
  if ($sockbr == 0) return
  if (%bot == $null) %bot = -
  echo -a %bot
  goto nextread
}


I typed !sabdetails rshield into one window with another account and the script executed, however it displayed the data in the topmost channel window in the mIRC window. It displayed this:

Quote:
HTTP/1.1 200 OK
Date: Sun, 04 Sep 2005 08:44:00 GMT
Server: Apache/2.0.54 (Win32) PHP/5.0.4
X-Powered-By: PHP/5.0.4
Content-Length: 569
Content-Type: text/html
-
--- Sabotage Details of rshield ---
Blackpowder Missiles: 0, Invisibility Shields: 0
Excaliburs: 0, Battle Axes: 0, Dragons: 0, Flaming Arrows: 0, Dragonskins: 0
Steeds: 0, Hammers of Thor: 0, Wargs: 0
Mithrils: 0, Gauntlets: 0, Heavy Shields: 0, Elven Cloaks: 0
Broadswords: 0, Warhammers: 0, Warblades: 0, Steel Bows: 0, Plate Armors: 0
Lances: 0, Maces: 0, Spears: 0, Longbows: 0, Chainmails: 0
Long Sword: 0, Pikes: 1, Clubs: 0, Crossbows: 0, Shields: 0
Staves: 0, Hatchets: 0, Slings: 0, Short Bows: 0
Helmets: 0, Knives: 0, Sticks: 0


Now i'm wondering how do i get that data after the first bit which just has some info, so from --- Sabotage details of <<username>> --- to the end of the data, sent to the channel window, where it was requested from? Sorry, i'm a n00b to this IRC langauge! xD Oh and i put the host socket line back in because someone i konw suggested putting it in because his won't work withouth it! :P

Re: Geting a webpage's data #129196 04/09/05 10:01 AM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
The display used echo -a , that is echo the active window...
Added a var %untarget that keeps the channel or query window where it was typed.

Used /sockmark to tell when the headers are gone (empty line)

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 &gt; 0) return
  sockread %bot
  while (($sockbr) &amp;&amp; (!$sockerr)) {
    if ($sock($sockname).mark) echo %untarget $iif(%bot != $null,%bot,-)
    elseif (%bot == $null) sockmark $sockname 1
    sockread %bot
  }
}

Re: Geting a webpage's data #129197 04/09/05 10:16 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
OK, i have that script, and it returns it to the window in mIRC, but it doesn't send it as a messge! frown How do i get it to do that? so that EVERYONE in that channel can see it? Sorry, i'm a real n00b, and getting tired now frown

Page 1 of 2 1 2