Blockland Forums > Modification Help
TCP Objects
<< < (2/7) > >>
jes00:

--- Quote from: Fluff-is-back on April 04, 2012, 10:03:05 AM ---Then it would probably better for you to use HTTPObjects:


new HTTPObject(GetThePage).get("google.com", "/file.txt"); // Create the HTTPObject and tell it to fetch the page "google.com/file.txt

function GetThePage::onLine(%this, %line)
{
    %this.page = %this.page NL %line; // Once we get a response, for every line we get, we want to add it all into a single buffer
}

function GetThePage::onDisconnect(%this)
{
    doStuffWithPage(%this.page); // The server has disconnected us, we therefore have the whole page stored in %this.page
}


--- End quote ---
It says the get function does not exist.
Fluff-is-back:

--- Quote from: Wordy on April 04, 2012, 10:37:56 AM ---So lets say I wanted to retrieve something from my website which is in txt format, lets say www.wordie.co.cc/text.html - it'll return with the text which I have wrote on it?

--- End quote ---

Unfortunately with the way torque works, you cannot have functions return networked data. The data from the page is stored in a variable.



--- Quote from: jes00 on April 04, 2012, 10:51:52 AM ---It says the get function does not exist.

--- End quote ---

It isn't a function, it's a method, you need to use it on a HTTPObject.
jes00:
Ok, now it just says DNS lookup failed: http
Fluff-is-back:

--- Quote from: jes00 on April 04, 2012, 12:29:00 PM ---Ok, now it just says DNS lookup failed: http

--- End quote ---

Then it's an error in the site's address
Destiny/Zack0Wack0:
Don't put http:// infront of the domain.
Navigation
Message Index
Next page
Previous page

Go to full version