Getting data from hosts that require HTTP Authentication with URLRequest in AS3

5 actionscript,as3,flash,work  |   June 13, 2008  |     3203

Hey Everyone,

just a quick note on getting data from a host that requires HTTP Authentication.. First:

  • It seems to only work with POST
  • If your server is in PHP (probably other languages too), GET or POST is the same thing, doesn’t matter. You can have bogus post data and still pass GET data in the URL.
  • You will require a library to encode in Base64, I suggest this one: http://crypto.hurlant.com/ it contains the class com.hurlant.util.Base64 that is simple to use!
  • You can’t use this online, it only works in the development environment!

Here is the code:

That’s it folks!

Comments
  • June 26, 2008 at 1:20 am

    bigop

    hello martin .
    is it possible to receive (and add ) data from google contact Api with this technique ?
    http://code.google.com/apis/gdata/basics.html

    thanks

  • August 14, 2008 at 7:03 am

    Piyush

    What would need to be done to do authentication online?

  • August 15, 2008 at 10:38 am

    Marti Legris

    Thing is, you can’t. The security model of Flash disables you to do that, as far as I can understand. This is not very well documented.

  • March 11, 2010 at 4:43 pm

    Martin Legris

    Ah, I found this post:

    http://kb2.adobe.com/cps/403/kb403184.html

  • November 20, 2014 at 9:33 am

    Noritaka

    My god, is that true? I stumbled acsros your blog while working on a project in CS5.5, whereas last one I used was CS3, this is spooky. Cheers!!(weird the official adobe help didn’t mention this)

Leave a Reply