Author Topic: How to use HTTPObjects  (Read 1184 times)

The title pretty much says what I want to do.

How would I connect to a web page, read the text on it, and then send it to blockland?

if anyone can help me with this, i'd be very thankful.
« Last Edit: December 20, 2010, 10:32:36 PM by otto-san »

Webpages come as HTML. You need an HTML Parser to display it, and Ephialtes himself said that would be impractical in Torquescript. Indeed, it would be... I can see the problems in it...

I can too. So there is no (good) way to do this? :U

I can too. So there is no (good) way to do this? :U

If you don't need the FULL page displayed like a web browser, it's doable. (Such as just needing specific information.) If you want it like a web browser, no luck.

My sing script actually is online. If I don't have the song I request, it'll go into Jonathan Coulton's official wiki and look for the lyrics there. If it finds them, it converts the html of the lyrics into normal text and saves it to a .txt file to load.

I just need to read the text on a page. Not a browser, just a thing that gets text.



HTTPObject or TCPObject
Oh, yeah, forgot about those.

How do you use them exactly?

Oh, yeah, forgot about those.

How do you use them exactly?
new HTTPObject(Httptest){};httptest.dump();

new HTTPObject(Httptest){};httptest.dump();
you don't need the {}

you don't need the {}
once again kalphiter supplies useful information

Alright, I got the webserver set up, it works, so now I'm going to mess around with HTTPObjects. :D

Having trouble getting text from it, do you use obj.get()?

if so, how exactly do you use that?
« Last Edit: December 20, 2010, 10:23:53 PM by otto-san »

new HTTPObject(Httptest){};httptest.dump();
replace the {}; with .
new HTTPObject(Httptest).dump();

bump. can anyone help with this?

.get("google.com:80", "/", "");

function asdf::onLine(%this, %line)
{
    echo(%line);
}