PHP Classes

How to Implement a PHP Short URL Redirect Checker using the URL Tracker Class: Get the URL to where a short URL redirects

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 67 All time: 10,346 This week: 89Up
Version License PHP version Categories
url-tracker 1.0.0MIT/X Consortium ...5HTTP, PHP 5
Description 

Author

This class can get the URL to where a short URL redirects.

It can take a short URL and sends an HTTP request to the respective Web server to determine the destination URL.

If the destination URL also redirects to another URL, the class also determines the respective destination URL until no more redirection happens.

The class returns an array with the list of all URLs it accesses until it reaches its final destination URL.

Innovation Award
PHP Programming Innovation award nominee
October 2022
Number 7
Short URLs help pass URLs of pages to other people in a way that may be easier to remember or type.

One challenge of short URLs is that they hide the actual destination URLs. If the pages of destination URLs have security issues, the users that get short URLs may not be aware of that until they access the short URL destination pages.

This package finds and returns the destination URLs of a given short URL. It may also return any intermediary URLs that browsers may need to access until they reach the final destination URL.

This way, developers may use security tools for auditing the safety of the final destination of the short URL, as well as all intermediary URLs.

Manuel Lemos
Picture of Chun-Sheng, Li
  Performance   Level  
Name: Chun-Sheng, Li <contact>
Classes: 36 packages by
Country: Taiwan Taiwan
Age: 31
All time rank: 21076 in Taiwan Taiwan
Week rank: 164 Up1 in Taiwan Taiwan Up
Innovation award
Innovation award
Nominee: 16x

Winner: 1x

Documentation

url-tracker

build

Introduction

  • It's for developers to track URL programmatically and avoid faking phishing URL with shorten URL.

Usage

  • Using this library is simple. Firstly, installing the library with following command:
composer require lee/url-tracker

  • Then using the following code to track URL easily:
require_once __DIR__ . '/vendor/autoload.php';

use Lee\Tracker;

$url = 'https://bit.ly/grpc-intro';
$trackedResult = Tracker::trackFromUrl($url); // ['https://bit.ly/grpc-intro', 'https://www.slideshare.net/williamyeh/grpc-238408172/williamyeh/grpc-238408172',]

  Files folder image Files (8)  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file .cs.php Example Example script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpcs.xml Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (8)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (8)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file build.yml Data Auxiliary data

  Files folder image Files (8)  /  src  
File Role Description
  Plain text file Tracker.php Class Class source

  Files folder image Files (8)  /  tests  
File Role Description
  Plain text file TrackerTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:67
This week:0
All time:10,346
This week:89Up
User Comments (5)
No support and does not answer issues.
1 year ago (Terry Woody)
20%StarStar
No support and does not answer issues.
1 year ago (Terry Woody)
20%StarStar
No support and does not answer issues.
1 year ago (Terry Woody)
20%StarStar
No support and does not answer issues.
1 year ago (Terry Woody)
20%StarStar
No support and does not answer issues.
1 year ago (Terry Woody)
20%StarStar