Posted By

Scooter on 04/11/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wizard04


Homeland Security Advisory System


 / Published in: ASP
 

URL: http://reusablecode.blogspot.com/2009/04/homeland-security-advisory-system.html

Returns the current national threat level as a string.

  1. <%
  2. ' Copyright (c) 2009, reusablecode.blogspot.com; some rights reserved.
  3. '
  4. ' This work is licensed under the Creative Commons Attribution License. To view
  5. ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or
  6. ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
  7. ' 94305, USA.
  8.  
  9. ' Obtain the current Department of Homeland Security threat level.
  10. function getThreatLevel()
  11. dim regEx
  12. set regEx = new RegExp
  13.  
  14. with regEx
  15. .Pattern = ".*\n.*CONDITION=""(.*)"" />"
  16. .IgnoreCase = true
  17. .Global = true
  18. end with
  19.  
  20. dim xmlhttp
  21. set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
  22. xmlhttp.open "GET", "http://www.dhs.gov/dhspublic/getAdvisoryCondition", "False"
  23. xmlhttp.send
  24.  
  25. getThreatLevel = regEx.replace(xmlhttp.responseText, "$1")
  26.  
  27. set xmlhttp = nothing
  28. set regEx = nothing
  29. end function
  30. %>

Report this snippet  

You need to login to post a comment.