News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Index folder on other server

Started by Cadish, August 15, 2003, 03:23:32 AM

Previous topic - Next topic

Cadish

Hi,
I want to index a folder on another server. How can i do this?

(with indexing a folder, i mean get a list of all the files in that folder)

Thx

[Unknown]

There's no way really, without internet access.

One way is to just harvest links, and try to find all the links... but that doesn't work to well.

Of course, this is if you don't get a listing when you try to access the folder... but then, why would you be asking?

-[Unknown]

Cadish


Chris Cromer

As [Unknown] said, why are you asking how to do it? Give us a ligit reason and you might be helped... otherwise it just sounds like your trying to hack someone.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Cadish

I have a php script (self-made) running on my server that allows users to view pictures more easily. I want to allow users to add their pictures too, but not on my server (because i don't have much space (50mb)).
I'm at a university (like all of my users), so each user has some space on a server of the university. So the users can upload their pictures on that server. If they give a link of the folder to me, i can index the folder to get all the pictures in it. And so display all of them with my script on my server.

One thing to do, is that they put a .txt file (with all the names of the pictures) in the folder, and that i use fopen and fread to get the names. But then the users have to make such a file, which is not very user-friendly ;)

So that's the reason i want to index some folders...

PS The university doesn't allow scripting, like php or cgi.

Chris Cromer

#5
Well if the university's server is on the net, and your server has access to the internet, then you can use file(); or fopen(); to retreive the html, then parse the html to figure out what files are in the folder.

And just a note, fopen does not work for retreiving a url on windows servers in older versions of php. So it might be wiser to use file();

But I can't give you an exact script because different web servers return different indexes with different html. So you will have to base it on what is returned from file or fopen.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Cadish

#6
What do you mean with 'the html'? Just the url of the folder? (like : http://www.university.com/user4531/images/ ?)

Is it possible to get the image size from the images too? Like: "img45.jpg: 400x300" ?

[edit]I've found a way to get the image size: getimagesize ( string filename [, array imageinfo])[/edit]

Chris Cromer

When you access the url you will get the output of either the server or the index file which is usualy html that contains that names of the files.

The list of files in the url is written in HTML, click view source to see the source... that's what file() will return, the source code of the page, which is html.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Cadish


Advertisement: