PDA

Click to See Complete Forum and Search --> : Retrieving URL clicked upon Winsock Connection?


azpc
Oct 9th, 2000, 02:11 AM
How can I retrieve the URL clicked upon Winsock Connection? My plan is to have a webpage that has a bunch of ftp links to a computer (i.e. ftp://13.57.12.65:6969/d:\download\something.zip), and i need to know what the user clicked on to get to my program. I've got a Winsock thing setup that looks like this..


WinS.LocalPort = "6969"
WinS.Listen
WinS.GetData URLFromClick


I need to get this so that I can parse it when it comes to the server computer, so that it can get the filename (i.e. d:\download\something.zip) and send it to the user. How can I attain the url that was clicked?

Flaming_Monkey
Oct 10th, 2000, 07:05 PM
What about something like this?

(From VBPJ October)

Private Function PageRequested (ByRef srHTTP As String) as String
Dim sSub As String
Dim nPosition As Integer

sSub = Left$(srHTTP, InStr$ (srHTTP, " HTTP/"))
nPosition = InStr(srHTTP, "/")

PageRequested = Trim$(Mid$(srHTTP, nPosition + 1, Len(sSub) - nPosition))
End Function


Just put the return value from winsock's getdata method as the srHTTP paramater. This will pull the page or file address, relative to the current page.
:)

azpc
Oct 10th, 2000, 11:26 PM
Yes, I already know how to split up the text from the URL, but lets say i have the internet explorer control on my form and it pulls up a website that connects to different clients that will be using my program (similar to napster interface). how can i get which link was clicked.. like if they click ftp://132.54.656.12:6969/j:\something\up.zip i need to know what they clicked because i need the end of that statement j:\something\up.zip so that the server (recieving users computer) will be able to send me the file. when i use the getdata method now it returns nothing off of a click from the webpage. do i need to put this under a certain item, right now i have it under WinS_DataArrival, and ive tried it under WinS_Connect and WinS_ConnectionRequest? Anyone can give me any info. Ohh by the way, thanks for the help that you gave, it fixed some of my code.