views:

63

answers:

1

For some reason when I use LoadVars in actionscript 2 to load cbsnews.com, I sometimes properly get the html for the page and other times I get GIF89a. I'm not sure what this means, so any help or suggestions would be appreciated. Here is some sample code to test it yourself.

var foo:LoadVars = new LoadVars();
foo.onData = function(bar) {
    trace(bar);
}
foo.load("http://www.cbsnews.com/");

Edit: I tried to follow the advice of Chris Shaffer, but it seems that there is no simple way of writing response into a gif file in flash. I feel like this is strange so I'll keep looking for a way to write the response into a gif file, but if anyone knows how or has another suggestion please let me know.

+1  A: 

GIF89a is the first several bytes of a .gif file; I'm just guessing, but perhaps CBS has limits on the number of requests you can make in a particular period of time, after which they serve up an image (to stop screen scraping and/or illegitimate use of the site).

It's just a guess; Is there a way you can make the request and save the full response to a file, so you could then view the .gif when it is returned?

Chris Shaffer
I've had it return GIF89a on the first time requesting it for over a day.
Anton
I would still recommend trying to save the full response when you see that header so you can see what the GIF is; It may contain a message that tells you what is happening.
Chris Shaffer
Also, if what you are looking for can be found in an RSS feed, it would be more friendly to them to use it than to hit the site, and may be more reliable for you.eg, http://feeds.cbsnews.com/CBSNewsMain
Chris Shaffer
I'm actually hitting the site to find out the rss link, and I could make a special case for when you see cbsnews.com to go to the rss feed directly, but that seems fairly lame.
Anton

related questions