Fetch url

You must Login before you can answer or comment on any questions.

Hello.

I wonder if anyone knows how to fetch a webpage source code? Is it possible with GET?

3 Answers

Accepted Answer

try this:

var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
 
    sourcecode = this.responseText;
 
Titanium.API.info(sourcecode);
 
};
 
xhr.open("GET","http://google.com");
xhr.send();

Tamas Daniel:

I've allready tried a few methodes and properties in HttpClient. But I can't get it to work.

Your Answer

Think you can help? Login to answer this question!