Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Loïc Faugeron:
Short Identifier
Jun 22, 2018 @ 18:12:21

Loïc Faugeron has a post on his site covering the concept of short identifiers and covering some of the common types along with some of the downsides of the use of each.

Sometimes resources can be identified by one of their attributes (a name, title, slug) and sometimes they can't (no name, or confidential name). In the later case, an ID needs to be artificially crafted.

Two of the popular strategies is to use either an auto incremental one or a universally unique one, however when it comes to share them publicly, both strategies present some drawbacks

He lists several different types including:

  • Auto Incremental IDs
  • Short IDs
  • Hashes
  • Alphabetical representation

In the end, the method he recommends is hashing the ID value and using the first few characters (much the way you can refer to commit hashes in the Git version control tool).

tagged: short identifier list tutorial hash autoincrement shorten

Link: https://gnugat.github.io/2018/06/15/short-identifier.html

99Points.info:
Youtube Style Share Button With URL Shortening using CURL, jQuery and PHP
Jul 29, 2010 @ 17:38:28

In a recent post on the 99Points.info blog Zeeshan Rasool walks you through the steps to create a share button with URL shortening using PHP, jQuery and curl.

These days every website must contain a section that is called “Share This”. After creating facebook style posting and youtube style rating system I have now come to share button. I have created youtube style share button with url shortening script. Try the demo and use this awesome tutorial on your web pages.

His tutorial includes all of the code needed - Javascript, PHP and some CSS - to create a small "share this" button that can be embedded in your site to open pages on the remote sites with the shortened URL for the current page.

tagged: tutorial url shorten share curl jquery youtube

Link:

Hasin Hayder's Blog:
expanding short url to original url using PHP and CURL
May 06, 2009 @ 17:59:51

Hasin Hayder has a quick post about taking a URL in the opposite direction than most seem to go these days - from shortened to the long, full URL.

Now when you get the short url shortened by using any of these services, you dont know where your browser is taking you! so if you are interested to figure out the original url hiding behind these short url, you need to have a little knowledge on how these services actually work.

Then the short URL is hit, the HTTP response is in the 300 family and the browser is redirected to the correct location. He uses cURL in PHP to grab this header information and parse out the full-length URL to return both the URL requested (the shortened one) and the full-length it was generated to point to.

tagged: shorten expand url service curl tutorial http header 300

Link:

NETTUTS.com:
Run Your Own TinyURL Service With Phurl
Jan 16, 2009 @ 21:31:59

In this recent tutorial from the NETTUTS.com website they show how you can create your own URL shortening service (think tinyurl or tr.im) with the help of the Phurl PHP application.

URL shortening services are a must if microblogging services like Twitter are to work. In 140 characters, you don't want the URL you're linking to eating up 100 of them. Or worse, it might not even fit. Enter TinyURL, and a bunch of other services that give you a shorter custom URL pointing to the target site. But why not roll your own, using Phurl? Let's do it!

The tutorial walks you through the installation (quick and easy thanks to a graphical installer) and some usage examples (with screenshots). A few other things - like branding and allowing multiple URLs - are suggested as future enhancements.

tagged: tinyurl service phurl tutorial shorten url

Link:

Raphael Stolt's Blog:
Tinyizing URLs with Zend_Http_Client
Nov 03, 2008 @ 13:55:00

In this new post today Raphael Stolt shows how to use the Zend_Http_Client component of the Zend Framework to "tinyize" a URL.

In a recent blog post Dave Marshall outlined a quick workaround for tweeting via the Zend_Http_Client component which is a reasonable approach for calling services that aren't in the Zend Framework core yet like Zend_Service_Twitter or are not supported out of the box. Therefore this post will try to describe a Zend Framework way of creating tinyized URLs.

He creates a UrlShorterner interface containing a shortenize() method that automates sending a URL over to the tinyurl.com web service and returning the results.

tagged: tinyize tinyurl zendhttpclient shorten url

Link:

Chris Shiflett's Blog:
PHP Tidbits
Oct 25, 2006 @ 12:34:05

Chris Shiflett, in working on a new, cleaner and leaner version of his site, shiflett.org, has come across a few "PHP tidbits" that he shares in his latest entry.

Just for fun, I'd like to share a couple of quick PHP tidbits with you that I wrote instead of starting on the real project at hand.

This post is the first of them, demonstrating two things . The first of which how you can make a useful tool with the SimpleXML functionality of PHP 5 and a REST API (like his example from Feedburner). His example grabs the statistics from the Feedburner API and pulls out the circulation number with two lines of code.

The second bit of functionality he shares is a quick function for shortening URLs to make them a bit easier to manage. It insets the ellipsis into the middle of the long URL to make it easier to squeeze into that layout.

tagged: tidbits example tutorial feedburner simplexml circulation shorten url tidbits example tutorial feedburner simplexml circulation shorten url

Link:

Chris Shiflett's Blog:
PHP Tidbits
Oct 25, 2006 @ 12:34:05

Chris Shiflett, in working on a new, cleaner and leaner version of his site, shiflett.org, has come across a few "PHP tidbits" that he shares in his latest entry.

Just for fun, I'd like to share a couple of quick PHP tidbits with you that I wrote instead of starting on the real project at hand.

This post is the first of them, demonstrating two things . The first of which how you can make a useful tool with the SimpleXML functionality of PHP 5 and a REST API (like his example from Feedburner). His example grabs the statistics from the Feedburner API and pulls out the circulation number with two lines of code.

The second bit of functionality he shares is a quick function for shortening URLs to make them a bit easier to manage. It insets the ellipsis into the middle of the long URL to make it easier to squeeze into that layout.

tagged: tidbits example tutorial feedburner simplexml circulation shorten url tidbits example tutorial feedburner simplexml circulation shorten url

Link:

Ryan Malesevich's Blog:
WP Plugins: WP-Chunk
Aug 24, 2006 @ 12:32:19

Ryan Malesevich is back on his blog today with a look at another WordPress plugin - WP-Chunk, a tool to split up large data so to conforms more to the page layout.

Occassionally I'll have someone post a comment that includes a URL. Wordpress automatically links to that URL, but often times it's too large for the alotted space. So depending on the browser, it might break it entirely. John recently wrote about a plugin that would fix that problem. WP-Chunk doesn't require much to work. There's no customization, or settings to change, it just works.

His example is of a long URL, but I imagine you could use it for any content that would cause the output of the post to expand out too far. And no configuration makes it even better!

tagged: wordpress plugin wpchunk long string shorten configuration wordpress plugin wpchunk long string shorten configuration

Link:

Ryan Malesevich's Blog:
WP Plugins: WP-Chunk
Aug 24, 2006 @ 12:32:19

Ryan Malesevich is back on his blog today with a look at another WordPress plugin - WP-Chunk, a tool to split up large data so to conforms more to the page layout.

Occassionally I'll have someone post a comment that includes a URL. Wordpress automatically links to that URL, but often times it's too large for the alotted space. So depending on the browser, it might break it entirely. John recently wrote about a plugin that would fix that problem. WP-Chunk doesn't require much to work. There's no customization, or settings to change, it just works.

His example is of a long URL, but I imagine you could use it for any content that would cause the output of the post to expand out too far. And no configuration makes it even better!

tagged: wordpress plugin wpchunk long string shorten configuration wordpress plugin wpchunk long string shorten configuration

Link:


Trending Topics: