Connect to IRC using HTTP API?
#1
Posted 27 September 2012 - 11:24 PM
#2
Posted 27 September 2012 - 11:33 PM
#3
Posted 27 September 2012 - 11:37 PM
*sigh*
Oh well, unless somebody has a dissenting opinion or some other advice, I'll have to crawl back into my cave and work on other *less interesting* things....
#4
Posted 28 September 2012 - 12:23 AM
#5
Posted 28 September 2012 - 12:58 AM
Lyqyd, on 28 September 2012 - 12:23 AM, said:
#6
Posted 28 September 2012 - 01:03 AM
This would be an awesome program because my server uses MonsterIRC and if the program connected to #Geevancraft, it could basically talk on my server!
#7
Posted 28 September 2012 - 03:13 AM
#8
Posted 28 September 2012 - 05:40 AM
The only possibility is if there were some PHP (or suchlike) page hosted someplace that would provide an API of sorts via http to connect to arbitrary IRC channels/servers. If you find that, you'll have a chance at making it work.
#9
Posted 28 September 2012 - 04:17 PM
#10
Posted 02 October 2012 - 12:21 AM
I'm working on it!
You see, you just have to use
string.sub()to get the chat out with the args arg2: "string.len" arg1: "htmlCode"!
So it actually is possible, heres the code I am working on.
local htmlCode = http.get("http://webchat.esper.net/?channels=#computercraft") local htmlLength = string.len(htmlCode) local htmlLengthP = table.tostring(htmlLength) local polishedHtml = string.sub(htmlCode, htmlLengthP) write(polishedHtml.readAll())I'm trying to extract the chat from the code...
#11
Posted 02 October 2012 - 12:28 AM
DSlink2010, on 02 October 2012 - 12:21 AM, said:
I'm working on it!
You see, you just have to use
string.sub()to get the chat out with the args arg2: "string.len" arg1: "htmlCode"!
So it actually is possible, heres the code I am working on.
local htmlCode = http.get("http://webchat.esper.net/?channels=#computercraft") local htmlLength = string.len(htmlCode) local htmlLengthP = table.tostring(htmlLength) local polishedHtml = string.sub(htmlCode, htmlLengthP) write(polishedHtml.readAll())I'm trying to extract the chat from the code...
That's not connecting to IRC, that's scraping chat from a web interface. You can't send chat that way, can you? You certainly can't interact with it to the degree that an actual client would be able to.
#12
Posted 02 October 2012 - 02:06 AM
Lyqyd, on 02 October 2012 - 12:28 AM, said:
DSlink2010, on 02 October 2012 - 12:21 AM, said:
I'm working on it!
You see, you just have to use
string.sub()to get the chat out with the args arg2: "string.len" arg1: "htmlCode"!
So it actually is possible, heres the code I am working on.
local htmlCode = http.get("http://webchat.esper.net/?channels=#computercraft") local htmlLength = string.len(htmlCode) local htmlLengthP = table.tostring(htmlLength) local polishedHtml = string.sub(htmlCode, htmlLengthP) write(polishedHtml.readAll())I'm trying to extract the chat from the code...
That's not connecting to IRC, that's scraping chat from a web interface. You can't send chat that way, can you? You certainly can't interact with it to the degree that an actual client would be able to.
Actually, webchat.esper.net uses qwebirc, which seems to use JavaScript for the UI, and a custom Python server for the IRC/HTTP bridge. Since communication from the client to the bridge is HTTP, you could probably use it from CC.
Scraping the page is not the way to do it, though.
#13
Posted 04 October 2012 - 08:01 AM
#14
Posted 04 October 2012 - 04:42 PM
Is this something I can use for what I want? I know nothing of programs outside of ComputerCraft, but I am willing to learn a bit of everything if I need to. It doesn't need to be elaborate, just functional.
#15
Posted 04 October 2012 - 06:51 PM
#16
Posted 04 October 2012 - 07:48 PM
#17
Posted 05 October 2012 - 07:00 AM
Additionally, looks like you don't even know how hard is to create such a website. A standard, free PHP web hosting doesn't offer enough features to keep the connection alive. You would need a dedicated server, and run your own application (written in C# for example) that can be remotely controlled via HTTP.
If you seriously want to establish a connection, you should forget about the HTTP API. If I were you, I'd create my own IRC client that can be controlled using the file system, f.e. by editing text files and writing command to them.
Well, since a C# program isn't too big, you could attach it to your Lua script and voila! you have a beautiful working IRC client. But without it, forget about connecting.
#18
Posted 05 October 2012 - 03:31 PM
Jajnick, on 05 October 2012 - 07:00 AM, said:
Additionally, looks like you don't even know how hard is to create such a website. A standard, free PHP web hosting doesn't offer enough features to keep the connection alive. You would need a dedicated server, and run your own application (written in C# for example) that can be remotely controlled via HTTP.
If you seriously want to establish a connection, you should forget about the HTTP API. If I were you, I'd create my own IRC client that can be controlled using the file system, f.e. by editing text files and writing command to them.
Well, since a C# program isn't too big, you could attach it to your Lua script and voila! you have a beautiful working IRC client. But without it, forget about connecting.
#19
Posted 06 October 2012 - 03:13 AM
#20
Posted 06 October 2012 - 03:20 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users