2017 © Pedro Peláez
 

library url-resolver

Redirects to final url

image

aboustayyef/url-resolver

Redirects to final url

  • Tuesday, September 29, 2015
  • by aboustayyef
  • Repository
  • 1 Watchers
  • 1 Stars
  • 498 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 0 Open issues
  • 1 Versions
  • 4 % Grown

The README.md

Welcome to URLResolver.php

This is a fork of URL Resolver by Matt Wright and contributors that works with composer and conforms to psr-4., (*1)

URLResolver.php is a PHP class that attempts to resolve URLs to a final, canonical link. On the web today, link shorteners, tracking codes and more can result in many different links that ultimately point to the same resource. By following HTTP redirects and parsing web pages for open graph and canonical URLs, URLResolver.php attempts to solve this issue., (*2)

Patterns Recognized

  • Follows 301, 302, and 303 redirects found in HTTP headers
  • Follows Open Graph URL <meta> tags found in web page <head>
  • Follows [Canonical] URL <link> tags found in web page <head>
  • Aborts download quickly if content type is not an HTML page

I am open to additional suggestions for improvement., (*3)

Usage

Resolving a URL can be as easy as:, (*4)

    use Resolver\URLResolver ;

    $resolver = new URLResolver();

    $resolver->isDebugMode(true);
    $resolver->setMaxRedirects(10);
    $resolver->setCookieJar('/mycookie.cookie');
    $resolver->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36');
    $resolver->resolveURL('http://t.co/Hb6cX2JyGM');

The Versions

29/09 2015

dev-master

9999999-dev

Redirects to final url

  Sources   Download

MIT

by Mustapha Hamoui

urls redirection