SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get hidden form values from another web page

    Hi,

    I received the following bit of code from a friend in need of help. I've done all I can do so far and need assistance with the rest. This code is supposed to get a web page and grab the necessary info from it so it can be used. After the page is grabbed I need to grab the values of 3 "hidden" input fields in a form.

    The fields look like this:
    <INPUT TYPE="HIDDEN" NAME="VARIABLE1" VALUE="CD5E56C4E89CFBE470D8B098C6897BABB6C037FD784765B0">
    <INPUT TYPE="HIDDEN" NAME="VARIABLE2" VALUE="CD5E56C4E89CFBE4B1B8B011899A4B44CCC7B734481F19ED67745C61F9EF16D0">
    <INPUT TYPE="HIDDEN" NAME="VARIABLE3" VALUE="D8F1A38F99B9320B">

    The code I have looks like this. I need help getting started on how to search thru the retrieved web page to get the above values.

    If someone knows of better code than what I have so far please feel free to enlighten me with it.

    Code:
    <%
      Response.Buffer = True
      Dim objXMLHTTP, xml
    
      ' Create an xmlhttp object:
    '  Set xml = CreateObject("Microsoft.XMLHTTP")
      ' Or, for version 3.0 of XMLHTTP, use:
       Set xml = CreateObject("MSXML2.ServerXMLHTTP")
    
      ' Opens the connection to the remote server.
      xml.Open "GET", "https://www.somewebsite.com", False
    	
      ' Actually Sends the request and returns the data:
      xml.Send
    
      'Display the HTML  as text
      Response.Write "<h1>The HTML text</h1><xmp>"
      Response.Write xml.responseText
      Response.Write "</xmp>"
    
      Set xml = Nothing
    %>

  2. #2
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fixed

    No one on this forum responded but I was able to get it working. If anyone has a better method I'd be happy to hear it.

    Code:
    <%
      Response.Buffer = True
      Dim objXMLHTTP, xml
    
      ' Create an xmlhttp object:
    '  Set xml = CreateObject("Microsoft.XMLHTTP")
      ' Or, for version 3.0 of XMLHTTP, use:
       Set xml = CreateObject("MSXML2.ServerXMLHTTP")
    
      ' Opens the connection to the remote server.
      xml.Open "GET", "https://www.somewebsite.com/", False
    	
      ' Actually Sends the request and returns the data:
      xml.Send
    
      MyArray = split(xml.responseText," ")
    
      For i = 1 to ubound(MyArray)
           if InStr(MyArray(i),"VARIABLE1") > 0 then
               DataExp = GetVar(MyArray(i+1))
           End If
    
           if InStr(MyArray(i),"VARIABLE2") > 0 then
               DataSlot = GetVar(MyArray(i+1))
           End If
    
           if InStr(MyArray(i),"VARIABLE3") > 0 then
               DataDir = GetVar(MyArray(i+1))
           End If
      Next
    
      response.write "<INPUT TYPE=""HIDDEN"" NAME=""VARIABLE1"" VALUE=" + DataExp + ">" + vbcrlf
      response.write "<INPUT TYPE=""HIDDEN"" NAME=""VARIABLE2"" VALUE=" + DataSlot + ">"  + vbcrlf
      response.write "<INPUT TYPE=""HIDDEN"" NAME=""VARIABLE3"" VALUE=" + DataDir + ">"  + vbcrlf
    
    function GetVar(data)
        SplitVarArray = split(data,"""")
        GetVar = SplitVarArray(1)
    End function        
    
      Set xml = Nothing
      Set RetData = Nothing
    %>

  3. #3
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    never mind, being dense. didn't see you were scraping. thought you had posted a form. your way looks fine.


Bookmarks

Posting Permissions

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