M
martin.lanny
I need to grab a html source code from the second page after I hit this
login screen with inserted variables:
example:
https://www.mypage.com/login.php?username=joe&password=joepsw
will lead to:
https://www.mypage.com/hello.php (this is the page I need a source
code from)
, it cannot be hit directly....
So, just to explain it more... If I hit the first url in browser it
logs me into another page and that is the page I need to get the html
source from.
I wrote this code:
Dim finalurl As String =
"https://www.mypage.com/login.php?username=joe&password=joepsw"
Dim webreq As System.Net.WebRequest =
System.Net.WebRequest.Create(finalurl)
Dim webres As System.Net.WebResponse = webreq.GetResponse()
Dim enc As System.Text.Encoding = _
System.Text.Encoding.GetEncoding("latin1")
Dim st As System.IO.Stream = webres.GetResponseStream()
Dim sr As New System.IO.StreamReader(st, enc)
Dim html As String = sr.ReadToEnd()
RichTextBox1.Text = html
sr.Close()
So it should log me in and get the code, but this is not happening.
It will get the source code of the first login page, not the second
one.
Why is it happening. Is it too fast? Is it not posting the variables
for username and password?
If that is the case, how can I first post the username and password to
php page and then grab a resulting source code?
Thanks a lot.
Martin
login screen with inserted variables:
example:
https://www.mypage.com/login.php?username=joe&password=joepsw
will lead to:
https://www.mypage.com/hello.php (this is the page I need a source
code from)
, it cannot be hit directly....
So, just to explain it more... If I hit the first url in browser it
logs me into another page and that is the page I need to get the html
source from.
I wrote this code:
Dim finalurl As String =
"https://www.mypage.com/login.php?username=joe&password=joepsw"
Dim webreq As System.Net.WebRequest =
System.Net.WebRequest.Create(finalurl)
Dim webres As System.Net.WebResponse = webreq.GetResponse()
Dim enc As System.Text.Encoding = _
System.Text.Encoding.GetEncoding("latin1")
Dim st As System.IO.Stream = webres.GetResponseStream()
Dim sr As New System.IO.StreamReader(st, enc)
Dim html As String = sr.ReadToEnd()
RichTextBox1.Text = html
sr.Close()
So it should log me in and get the code, but this is not happening.
It will get the source code of the first login page, not the second
one.
Why is it happening. Is it too fast? Is it not posting the variables
for username and password?
If that is the case, how can I first post the username and password to
php page and then grab a resulting source code?
Thanks a lot.
Martin
