Expected Behavior
- Enter a shortened URL
- Foreach layer of redirection, display the URL
- When the final layer of redirection is concluded, report that URL
Current Behavior
In many cases, running curl --location --head $url on the command line will work just fine in many cases where the redirect is done in the HTTP layer. However, when a service depends upon HTML and JS, things get more tricky.
Possible Solution
Start with a generic solution.
When a URL is compared to a list of known services that do things differently, wrap that behavior in a separate class or function.
Using GuzzleHttp will be of great help.
Context
Many sites offer a link shortening service. Some are site-specific ( e.g. https://lnkd.in/eX-UN9B6 by LinkedIn ) while others are more general purpose, like bit.ly. In either case, it would be good to take in the shortened URL, and unwrap it, until the final location is known. Then retrieve the final location.
Expected Behavior
Current Behavior
In many cases, running
curl --location --head $urlon the command line will work just fine in many cases where the redirect is done in the HTTP layer. However, when a service depends upon HTML and JS, things get more tricky.Possible Solution
Start with a generic solution.
When a URL is compared to a list of known services that do things differently, wrap that behavior in a separate class or function.
Using GuzzleHttp will be of great help.
Context
Many sites offer a link shortening service. Some are site-specific ( e.g. https://lnkd.in/eX-UN9B6 by LinkedIn ) while others are more general purpose, like bit.ly. In either case, it would be good to take in the shortened URL, and unwrap it, until the final location is known. Then retrieve the final location.