Custom response headers URLRequest AS3


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var url:String = _baseURL + "/utils.php";
  2.  
  3. var headers:Array = [
  4. new URLRequestHeader("_sessionKey", _sessionKey),
  5. new URLRequestHeader("_userId", _sessionUserId)
  6. ];
  7.  
  8. var request:URLRequest = new URLRequest();
  9. request.requestHeaders = headers;
  10. request.method = URLRequestMethod.POST;
  11. request.url = url;
  12.  
  13. ///////////////////
  14.  
  15. var loader:URLLoader = new URLLoader();
  16. loader.dataFormat = URLLoaderDataFormat.TEXT; //don't know if this is really needed
  17. loader.addEventListener(Event.COMPLETE, handleSuccess);
  18. loader.addEventListener(IOErrorEvent.IO_ERROR, handleError);
  19. loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleError);
  20.  
  21. loader.load(request);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.