For example, we have this website: "http://www.website.com/"
Is any possibility to know the name of the subfolders of this site, for example:
"http://www.website.com/data/"
or
"http://www.website.com/data/sql"
Thank you
Printable View
For example, we have this website: "http://www.website.com/"
Is any possibility to know the name of the subfolders of this site, for example:
"http://www.website.com/data/"
or
"http://www.website.com/data/sql"
Thank you
Only if the web server has directory listings turned on. If not, you will get a (403?) - Forbidden error.
The only other way would be if you have FTP access to the server.
An how can I make a directory listing from a website? Inet, WinSock? Or other?
Suggestions needed.
Thank you.
A website will list directories if it has that setting enabled. Otherwise, it won't and there is no way to get it to.
Example of directory listings:
http://www.dannydotguitar.com/images/
Now if I were to go and turn them off (which I've been meaning to do) then you wouldn't see those directories listed, you would just see an error message.
What I mean is: how can I do that programmatically, in vb6?
Thank you
If you can put your vb6 application on the server and excute it there, then possibly (thought I don't know how) you can do it.
But if you don't have access to the web-server, there is nothing you can do...
That setting is on the server only...
I think he meant how to receive the directory listing from his VB program.
If that's not what you mean then CVMichael is right.
If you want your program to receive the directory listings then you can use something like this:
Add a winsock control (Winsock1) to your form and paste this code in there:
Note that, even with directory listings enabled on the web server, you still might not get a directory listing returned, because:Code:Option Explicit
'Received data buffer.
Private strBuffer As String
Private Sub Form_Load()
With Winsock1
.Close
strBuffer = vbNullString
.Connect "www.dannydotguitar.com", 80
End With
'The winsock control is now connecting.
'If it connects successfully, the Connect() event will fire.
'If there is an error, the Error() event will fire.
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Winsock1.Close
strBuffer = vbNullString
End Sub
'Connected to web server.
Private Sub Winsock1_Connect()
'We're connected, so send the GET request.
'In this case, it's for the folder /images/.
'If you request a folder and the server has directory
'listings enabled, then it will return the directory listing.
'Unless there is an index.html/index.php file in that folder.
Dim strGET As String
strGET = "GET /images/ HTTP/1.1" & vbCrLf
strGET = strGET & "Host: www.dannydotguitar.com" & vbCrLf
strGET = strGET & "User-Agent: VB" & vbCrLf
strGET = strGET & "Accept: *.*" & vbCrLf
strGET = strGET & "Connection: Close" & vbCrLf & vbCrLf
Winsock1.SendData strGET
'GET request is sending.
'Next event to fire should be the DataArrival() event.
End Sub
'Receiving data.
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData strBuffer, vbString, bytesTotal
Debug.Print strBuffer
End Sub
'Connection error.
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Winsock1.Close
MsgBox Description, , "Error (#" & Number & ")"
End Sub
a. The directory has an index file (index.html, index.php, etc.)
b. The directory is password protected (htaccess)
c. And a few other reasons that aren't coming to mind right now...