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.
Bookmarks