Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2003
    Location
    Shanghai, China
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Make a WHOIS search via XMLHTTP

    This HTA called a WebService by posting an XML. Here is a description of the service:
    http://66.165.154.102/whois.asmx?op=GetWhoIS

    Save the following code as "WHOIS.hta". Then launch it(For Windows 9x+ & IE 5.5+).
    And it's easy to convert it to asp. So it may works well on your web server, too.

    Code:
    <html>
    <head>
    <title>WHOIS WebService</title>
    <!-- Edited by LeXRus http://LeXRus.blueidea.com/ -->
    <meta http-equiv="Content-Type" content="application/hta; charset=utf-8">
    <HTA:APPLICATION ID="oHTA" APPLICATIONNAME="WHOIS" BORDER="thick" BORDERSTYLE="normal" CAPTION="yes" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="yes" SHOWINTASKBAR="yes" SINGLEINSTANCE="no" SYSMENU="yes" VERSION="0.73B" WINDOWSTATE="normal"/>
    <style>
    body{background:buttonface;border-width:0px;overflow:auto;}
    #domain{border:2px inset; font-size:11px;font-family:verdana;width:200px;text-align:center;}
    #submit{border:2px outset;font-size:11px;font-family:verdana;font-weight:bolder;}
    textarea{width:100%;height:350px;border:2px inset;font-size:11px;font-family:verdana;overflow:auto;}
    div{font-size:11px;font-family:verdana;}
    h1{font-size:24px;font-family:tahoma;vertical-align:middle;}
    </style>
    </head>
    
    <body onload="window.resizeTo(600,500)" onresize="window.resizeTo(600,500)">
    <div align="center">
    <h1>WHOIS Search</h1>
    <u>D</u>omain: <input type="text" id="domain" accesskey="d" value="blueidea.com"/>
    &nbsp;<button id="submit" type="button" onclick="submitSearch()" accesskey="s"><u>S</u>ubmit</button>
    </div>
    <br/>
    <div align="center"><textarea id="result"></textarea></div>
    <script>
    var
    url='http://66.165.154.102/whois.asmx',
    soapRequestStr='<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><GetWhoIS xmlns="http://www.webserviceX.NET"><HostName>blueidea.com</HostName></GetWhoIS></SOAP-ENV:Body></SOAP-ENV:Envelope>'
    
    var
    xmlhttp=new ActiveXObject('msxml2.xmlhttp')
    xmlhttp.onreadystatechange=getReady
    xmlhttp.open('POST',url,true)
    xmlhttp.setRequestHeader('Referer',url)
    xmlhttp.setRequestHeader('Content-Type','text/xml;charset=utf-8')
    xmlhttp.setRequestHeader('SOAPAction','http://www.webserviceX.NET/GetWhoIS')
    xmlhttp.setRequestHeader('Content-Length',soapRequestStr.length)
    
    var
    xmldoc=new ActiveXObject('msxml.domdocument')
    xmldoc.loadXML(soapRequestStr)
    
    function submitSearch(){
    	xmldoc.selectSingleNode('//HostName').text=domain.value
    	xmlhttp.abort()
    	xmlhttp.onreadystatechange=getReady
    	xmlhttp.open('POST',url,true)
    	xmlhttp.setRequestHeader('Referer',url)
    	xmlhttp.setRequestHeader('Content-Type','text/xml;charset=utf-8')
    	xmlhttp.setRequestHeader('SOAPAction','http://www.webserviceX.NET/GetWhoIS')
    	xmlhttp.setRequestHeader('Content-Length',soapRequestStr.length)
    	xmlhttp.send(xmldoc)
    	submit.disabled=true
    	submit.innerText='Searching...'
    }
    
    function getReady(){
    	if(xmlhttp.readyState==4){
    		result.value=xmlhttp.responseXML.selectSingleNode('//GetWhoISResult').text.replace(/[\s\S]+Network Solutions reserves the right to modify these terms at any time\./,'')
    		submit.disabled=false
    		submit.innerText='Submit'
    	}
    }
    </script>
    </body>
    </html>
    excuse my poor english~

  • #2
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    I haven't tested this out- can you describe in more detail what the script actually does or how it is useful?

    Thanks,
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Does HTA allow you to reach out of the originating domain with XMLHTTP? Because JavaScript shouldn't be able to do that. (SHOULD NOT according to the ECMA specification, that is.)


    In the case of a normal homepage, in ie5.5w you could, but ie6w has stricter rules when it comes to this. So, does HTA allow this thing that JavaScript shouldn't be able to do?
    Last edited by liorean; 02-01-2004 at 01:13 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #4
    New Coder
    Join Date
    Aug 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    An HTA does allow javascript to go beyond the 'local' domain, that's the beauty and curse of it. You will see virii that use hta because it also allows you to write to the registry. HTA or Hypertext Application basically has the same power as a .exe.

  • #5
    New Coder
    Join Date
    Aug 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nice application. Opens up other possibilities of page requests.

  • #6
    New to the CF scene
    Join Date
    May 2003
    Location
    Shanghai, China
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not only in hta, but also in local script.
    so when you call an xmlhttp object in a local html page to "go beyond the 'local' domain", it works well.
    excuse my poor english~


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •