Results 1 to 1 of 1

excel Web query with login and password

Threaded View

  1. #1
    Registered User
    Join Date
    12-02-2008
    Location
    USA
    Posts
    38

    excel Web query with login and password

    Hi
    I have a website with "site" name, "login" and "password". I am trying to access this web site with all of the above information supplied from excel using the following code.
    Sub Login_WebQuery()
    Dim MyPost As String
    Const MyUrl As String = "http://fioumes.emea.nsn-net.net:7001/login"
    Const PostUser As String = "SITE=prepro" 'Change user name here
    Const PosPassword As String = "&LOGON_ID=lleo" 'Change password here
        Const PostPassword As String = "&PASSWORD=anna123" 'Change password here
    MyPost = PostUser & PosPassword & PostPassword
        
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;" & MyUrl, Destination:=Cells(1, 1))
        .PostText = MyPost
        .BackgroundQuery = True
        .TablesOnlyFromHTML = True
        .Refresh BackgroundQuery:=False
        .SaveData = True
    End With
        
    End Sub
    It is not working.

    This is the data from "View Source" of this website

     
     function setInitialFocus()
                {
                    var focusField = PageHelper.getHiddenFieldById( "SITE" );
                    if( focusField.value != "" )
                    {
                        var loginField = PageHelper.getHiddenFieldById( "LOGON_ID" );
                        if( loginField.value != "" )
                        {
                            var passwordField = PageHelper.getHiddenFieldById( "PASSWORD" );
                            if( passwordField.value == "" )
                                focusField = passwordField;
                        }
                        else
                            focusField = loginField;
                    }
                    focusField.focus();
                }
     
                function setTimezoneOffset()
                {
                    var date = new Date();
                    var timezoneOffset = date.getTimezoneOffset() * -1;
                    PageHelper.addHiddenFormField( "MAIN", "TIMEZONE_OFFSET", timezoneOffset );
                }
                
                function forgeCredentials() {
                    document.getElementById("forgedUsername").value = 
                        document.getElementById("SITE").value 
                        + "/" + document.getElementById("LOGON_ID").value;
                    // alert(document.getElementById("forgedUsername").value);
                    
                    document.getElementById("forgedPassword").value =
                        document.getElementById("PASSWORD").value;
                    // alert(document.getElementById("forgedPassword").value);
                }
     
                function checkPODFrame() {
                    //This method is used to prevent from showing login screen in subframe of the POD,
                    //it should fill the whole POD window.
                    if (parent.PodMain != undefined) {
                        parent.location.reload();
                    }
                }
                
                function doAppContainerLogon() {
                	if ("/login"=="/j_security_check"
    						|| "/login"=="/") {
                		// Manual validation of user passed, so container login module should succeed
                		// So, submit credentials.
    					document.forms[0].submit();
                	}
                }
     
            </script>
        
    </head>
    Appreciate yur help.
    Last edited by teylyn; 09-16-2010 at 08:42 PM. Reason: repaired code tag

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1