cantene
Nov 25th, 2000, 07:25 AM
Dear all friends,
I am writing a desktop application to retrieve some files resided on the Internet using an winsock OXC called dsSocket.
The files are to be captured by submitting forms to the website but first I have to log in (by submitting log in forms) to the website before I can download any files from it.
I send the following HTTP POST request to login to the website:
szLogData = "page=authentication&login=cantene&password=xxxxx"
szRequest = "POST /main.phtml HTTP/1.0" & vbCrLf
szRequest = szRequest & "Accept: text/plain" & vbCrLf
szRequest = szRequest & "User-Agent: Mozilla/4.0 (compatible;MSIE 4.01;Windows NT)" & vbCrLf
szRequest = szRequest & "Host:www.xxx.com:80" & vbCrLf
szRequest = szRequest & "Connection:Keep-Alive" & vbCrLf
szRequest = szRequest & "Content-type: application/x-www-form-urlencoded" & vbCrLf
szRequest = szRequest & "Content-length:" & Str$(Len(szLogData)) & vbCrLf
szRequest = szRequest & vbCrLf
szRequest = szRequest & szLogData & vbCrLf & vbCrLf
dsSocket1.Send = szRequest
and the ReceiveData is the Logged in page:
HTTP/1.1 200 OK
Date: Fri, 24 Nov 2000 17:13:57 GMT
Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) PHP/4.0.0 mod_perl/1.24
X-Powered-By: PHP/4.0.0
Connection: close
Content-Type: text/html
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
:
key=hsfdhgkjshjfhljshflsjlkf
:
</HTML>
I hope to extract the key from the page using standard string parsing functions and put it in the download file form to download the actual file.
But the connection has closed automatically after receiving the above HTML data chuck.
How can I can keep the connection alive so that I can submit another form?
Also, will the ReceiveData parameter still keep the above HTML chunk when the next data arrives? Is there another method to clear ReceiveData before receiving the next data block. Thanks a lot for your help
I am writing a desktop application to retrieve some files resided on the Internet using an winsock OXC called dsSocket.
The files are to be captured by submitting forms to the website but first I have to log in (by submitting log in forms) to the website before I can download any files from it.
I send the following HTTP POST request to login to the website:
szLogData = "page=authentication&login=cantene&password=xxxxx"
szRequest = "POST /main.phtml HTTP/1.0" & vbCrLf
szRequest = szRequest & "Accept: text/plain" & vbCrLf
szRequest = szRequest & "User-Agent: Mozilla/4.0 (compatible;MSIE 4.01;Windows NT)" & vbCrLf
szRequest = szRequest & "Host:www.xxx.com:80" & vbCrLf
szRequest = szRequest & "Connection:Keep-Alive" & vbCrLf
szRequest = szRequest & "Content-type: application/x-www-form-urlencoded" & vbCrLf
szRequest = szRequest & "Content-length:" & Str$(Len(szLogData)) & vbCrLf
szRequest = szRequest & vbCrLf
szRequest = szRequest & szLogData & vbCrLf & vbCrLf
dsSocket1.Send = szRequest
and the ReceiveData is the Logged in page:
HTTP/1.1 200 OK
Date: Fri, 24 Nov 2000 17:13:57 GMT
Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) PHP/4.0.0 mod_perl/1.24
X-Powered-By: PHP/4.0.0
Connection: close
Content-Type: text/html
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
:
key=hsfdhgkjshjfhljshflsjlkf
:
</HTML>
I hope to extract the key from the page using standard string parsing functions and put it in the download file form to download the actual file.
But the connection has closed automatically after receiving the above HTML data chuck.
How can I can keep the connection alive so that I can submit another form?
Also, will the ReceiveData parameter still keep the above HTML chunk when the next data arrives? Is there another method to clear ReceiveData before receiving the next data block. Thanks a lot for your help