|
-
Nov 6th, 1999, 01:31 AM
#1
Thread Starter
New Member
What is the source code to connect to a website, and get the source code and put it in a txt box?
-
Nov 7th, 1999, 03:27 PM
#2
Lively Member
Here's how to open a file via Winsock.
An easier way is using Internet Control but here is how to do it via Winsock.
This code will add some HTTP header info that you will need to remove, Internet Control does this automatically...
This code is not perfect, its from the top of my head, if you want the exact code
Email me for it.. Add a winsock control to a new form and a text box and a command button
'---------------------------------------------------
' Download a file directly via Winsock via HTTP port
'---------------------------------------------------
'
Dim DownloadData as String
Private Sub DownloadCMD_Click()
'connect to the web server directly
winsock1.connect "www.website.com", 80
End Sub
Private Sub Winsock1_Connect()
'weve connected, lets send the HTTP request
'you MUST have the two vbcrlf after the command
winsock1.senddata "GET /index.htm HTTP/1.0" & vbcrlf & vbcrlf
End Sub
Private Sub Winsock1_DataArrival(totalBytes as long)
'weve recieved some data, append it
winsock1.getdata TempDownloadString, vbString
DownloadData = DownloadData & TempDownloadString
End Sub
Private Sub Winsock1_Close()
'download has completed, save the data to a file
Text1.text = DownloadData
End Sub
[This message has been edited by privoli (edited 11-08-1999).]
-
Nov 12th, 1999, 09:49 PM
#3
New Member
1) So when you are done downloading a page, it automatically closes the connection?
2) How come it doesn't work for me? I try to connect to www.pinionsolutions.com and everytime I request a page to download, it returns a 302 error saying that the page has moved! But how has it moved if it's in the same place it always was (it says it has moved to index.html, the same url I requested)? Just try it and see what I mean.
Thanks!
-Matthew B.
[This message has been edited by MatBielich (edited 11-13-1999).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|