![]() |
Reverse TinyURLs
php Code:
Snazzy ^^ |
Cool, now all we need is a library. :-(
|
You do have a point ;-) I'll have to get onto it this week sometime.
|
Nice! (char limit)
|
Quote:
It's not that much work to develop such a class because they are quite simple. I think we only need one method which we pass the URL. |
PHP Code:
|
I know this is an old topic, but given the recent bump it should be ok to have a quick chat on the subject.
When trying to resolve where TinyURLs are supposed to go, wouldn't it make more sense just to send a HEAD request to the TinyURL and see where it points rather than scraping the service-specific preview page in the hope the HTML reflects what you want and the value there is accurate. The HEAD request method should also work across a wide number of URL shortening services making your code much easier if you wish/need to handle multiple services. |
I recently made a script that works for all URL shortening services: http://www.evanbot.com/article/url-lengthener/25
It uses cURL to get the redirect headers to find the original URL. |
I'm not sure if you want this comment on your blog.
This script has a great starting direction. For example, if you wanted to give users the visibility of the long url, and still give the short url service the correct traffic you could do something like this. PHP Code:
You could however do something similar to whitehouse.gov and display a popup whenever the user wants to visit a short URL. Better yet, when the user click the short url you could have a default setting that changes the <a>'s visible text to that longer URL. (The href="" could change based on the user preference.) This would give users added security and comfort in where they are headed. |
That's not an issue with the script, but rather an issue with your implementation. Simply make the href attribute the long URL and the link text same as the original link text to avoid confusion. Remember the script only gets the URL, it is up to you implement it correctly.
|
Quote:
|
No I understood you correctly... Maybe a good example would help:
PHP Code:
|
Wouldn't this defeat the purpose of the tinyUrl in the first place,
I could see getting the original link back to parse as you wish, but the user is posting it as that is how they want it displayed ... to get link text you would need to parse the URL and get it from there (unless you have a WYSIWYG) that changes the link text ( this to would defeat the purpose of tinyURL parsing.. ) if the link has a list of parameters that are added to the query string in the HREF attribute they will still be weary of the link, especially if it is not a trusted site .... ? |
Quote:
The issue comes into play when search engines and advanced users see what is going on, both when presented with two different links will become paranoid. The advanced user may copy the visible text and paste that in, while the search engine may mark the page as spam/malicious. My goal was to give all parties involved the best outcome, but in further contemplation I've decided that doing something similar to search.twitter.com would be better. The user should have the option to expand the link (for security), and the search engine should be able to mark the page as safe. |
If I remember correctly, this topic was about finding where tinyURLs went. That's what my script does. No more, no less.
How useful it is (or isn't) depends on how you use it. A good example of implementation would be say for blog comment posts, where the comment author may provide a link to his/her website. In this case you may want to automatically convert the URL to its full version if given a short URL. |
I'll have to get onto it this week sometime.....
__________________________________________ We cease loving ourselves if no one loves us WOW Gold |
| All times are GMT. The time now is 03:30 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0