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   View files Documentation   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (8)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 67 This week: 1All time: 10,312 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: 28 packages by
Country: Taiwan Taiwan
Age: 30
All time rank: 22526 in Taiwan Taiwan
Week rank: 6 Up1 in Taiwan Taiwan Up
Innovation award
Innovation award
Nominee: 14x

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  
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  /  .github  
File Role Description
Files folder imageworkflows (1 file)

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

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

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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:67
This week:1
All time:10,312
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