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 (1)   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-10-05 (23 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 33 This week: 4All time: 10,584 This week: 28Up
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.

Picture of Chun-Sheng, Li
  Performance   Level  
Name: Chun-Sheng, Li <contact>
Classes: 12 packages by
Country: Taiwan Taiwan
Innovation award
Innovation award
Nominee: 5x

Details

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:33
This week:4
All time:10,584
This week:28Up
For more information send a message to info at phpclasses dot org.