Earlier this month, I wrote about finding the destination of a redirect using cURL in PHP. This can be a useful function to use whenever:
- you know the URLs with which you’re dealing are going to redirect,
- you know that the number of redirects will be limited to one.
Granted, in the latter case, it’s becoming more difficult because sites like, say, Twitter, have multiple redirects before you get to the destination.
But that’s a topic for another post (unless you just want to implement a recursive or iterative way of working through requests until you find the final destination).
Anyway, there’s another thing that can also be useful whenever you’re working with redirects and with cURL, and that’s determining if the specified URL takes you to a valid page.