# Grabbing the source code of an HTML page?

**URL:** <https://forum.kirupa.com/t/grabbing-the-source-code-of-an-html-page/227839>\
**Category:** flash\
**Created:** [June 2, 2007, 11:06pm UTC](https://forum.kirupa.com/t/grabbing-the-source-code-of-an-html-page/227839 "2007-06-02T23:06:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RoboLlama](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@RoboLlama](https://forum.kirupa.com/u/RoboLlama)\
**Post date:** [June 2, 2007, 11:06pm UTC](https://forum.kirupa.com/t/grabbing-the-source-code-of-an-html-page/227839/1 "2007-06-02T23:06:38Z")

</div>

Is it possible using AS2.0 to grab the HTML source code of a webpage and store it as a string? I’ve always wanted to do something like this and a few years ago it was only semi-possible. Is anyone aware of new developments in Flash/Actionscript that would allow this?

The closest I’ve come in my attempts to do this is with this code (thanks to McGiver, about 3 years ago):

```auto

webcode = new LoadVars();
webcode.load("http://www.google.com");
webcode.onLoad = function() {
	trace(unescape(this));
};

```

However, while the above code does manage to output some of the source code of the given URL, it is somewhat jarbled.

For my original post years ago, see [http://www.kirupa.com/forum/showthread.php?t=63793](http://www.kirupa.com/forum/showthread.php?t=63793)
