Forum Moderators: coopster

Message Too Old, No Replies

linking to changing hyperlink

         

Champak

3:05 am on Mar 10, 2007 (gmt 0)

10+ Year Member



Is it possible to link to a file whos name changes everyday? How?

I tried doing a search for "dynamic hyperlinking" because that is what I assume I'm trying to do, but came up with nothing.

Thanks.

[edited by: Champak at 3:06 am (utc) on Mar. 10, 2007]

eelixduppy

3:11 am on Mar 10, 2007 (gmt 0)



Sure, it should be possible, however, there should be some sort of pattern in the file name otherwise you aren't really going to be able to tell, unless it's the only file with that directory.

You can readdir [us3.php.net] the directory and match the file based on the pattern in the different filenames.

Champak

1:10 am on Mar 16, 2007 (gmt 0)

10+ Year Member



OK, here are the patterns of the three sites
1/
[#*$!XX.com...]
[#*$!XX.com...]
[#*$!XX.com...]

I can't figure this one out

2/
[YYYYYY.com...]
[YYYYYY.com...]
[YYYYYY.com...]
[YYYYYY.com...]

I can't figure this one out

3/
[sub.us.ZZZZ.com...]
[sub.us.ZZZZ.com...]
[sub.us.ZZZZ.com...]
[sub.us.ZZZZ.com...]

This one I came up with the following solution:
<?php
$MarketUpdateTime1 = date('Y-m-d');
echo '<a href=https://sub.us.ZZZZ.com/Last/Path/' . $MarketUpdateTime . '-a/nybrok.pdf>TEST</a>';
?>

Problems.

1/ This may cancel out everything that I'm trying to do, If the link is going to be php based like the example in (3), I am in problems because I need to place it in mysql and it does not seem to work from there.

2/ I don't see how to read dir in another url. From what I see and have tried the readdir is for your own dir. I need to read another url.

3/ With last problem is, these really have to search for the most recent date, because on weekend for example, there wont be a new file, and sometimes a couple days go by without a new file. So (3) for example would cause problems on Sat, Sun, even a holiday. (1) you'll notice there is no link for the 14th, that's because there was no new file on the 14th, so that would have caused a problem if someone went for a file on the 14th.

NOTE: what I was thinking is doing 'filemtime' and if a file has a "filemtime" that is greater than yesterday, grab that. What are your thoughts on that? The only problem is, I don't know what else may be in that directory, and that wouldn't work for (3). So that probably isn't a good idea anyway.

Thanks for any and all help.