chasethemetal Posted December 11, 2011 Share Posted December 11, 2011 Hey all! I'm running a script that downloads a file from a site. The client facing url looks something like this http://media.site.com/83jdks9dj?id=1 when I put that url into the web browser it gets resolved to a large url that actually then stream/downloads the media. I'm using wget to download then place the file into a directory on my site. But the issue is that wget needs the resolved url not the url that you see in the code. Is there any way in php to store the resolved url in a var? in theory something like this $src = 'http://media.site.com/83jdks9dj?id=1'; //unresolved url $srcResolved = resolve_url($src); thanks! Link to comment Share on other sites More sharing options...
Ingolme Posted December 12, 2011 Share Posted December 12, 2011 I believe that if you use the cURL library, you can see the location header that the site sends you when you send a request, which should contain the URL you're looking for. Link to comment Share on other sites More sharing options...
chasethemetal Posted December 12, 2011 Author Share Posted December 12, 2011 Interesting. Thank you. I ended up solving my issue, which was that my wget code was a little broken, so it ended up resolving the urls and working. But still good to know for potential future purposes! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.