soupphysics Posted May 23, 2007 Share Posted May 23, 2007 I have a php script that will find some links to some files in a webpage. The problem is that the links on the webpage are links to a redirecting link, and what I am trying to get is the adress that it redirects to. I want to make a list with links directly to the actual url and location of the files, and not links to the location that just redirects to the files. I need someway to make a php script get this adress. When I try to open the redirect link with file(), it just opens the file that it is being redirected to, and I don't want to open the file. Just get the actual adress for it. Hope it makes some kinda sense. Anyone know a way? Link to comment https://forums.phpfreaks.com/topic/52631-how-to-get-adress-for-a-file-that-a-link-redirects-to/ Share on other sites More sharing options...
trq Posted May 23, 2007 Share Posted May 23, 2007 We need to see a sample of what the redirection code looks like. I'm assuming its javascript, you'll need to parse it to get the address your after. Link to comment https://forums.phpfreaks.com/topic/52631-how-to-get-adress-for-a-file-that-a-link-redirects-to/#findComment-259737 Share on other sites More sharing options...
soupphysics Posted May 23, 2007 Author Share Posted May 23, 2007 I am not hosting the link that redirects it. However it is standard html redirect. I guess what I need is to be able to get the header for a specific url and location. Link to comment https://forums.phpfreaks.com/topic/52631-how-to-get-adress-for-a-file-that-a-link-redirects-to/#findComment-259758 Share on other sites More sharing options...
kathas Posted May 23, 2007 Share Posted May 23, 2007 you can use http_get() that has default to 0 redirects so u are sure to get the page u want. Link to comment https://forums.phpfreaks.com/topic/52631-how-to-get-adress-for-a-file-that-a-link-redirects-to/#findComment-259772 Share on other sites More sharing options...
soupphysics Posted May 23, 2007 Author Share Posted May 23, 2007 Thanks, I will look into that one. I the mean time I found a solution on php.net on the fopen page though. One person made an example that with a little modification just gives me the header information. But I will check out the on you gave me, and see what's best. Yours actually seem simpler. Thanks. Link to comment https://forums.phpfreaks.com/topic/52631-how-to-get-adress-for-a-file-that-a-link-redirects-to/#findComment-259891 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.