aboustayyef/url-resolver
Composer 安装命令:
composer require aboustayyef/url-resolver
包简介
Redirects to final url
关键字:
README 文档
README
This is a fork of URL Resolver by Matt Wright and contributors that works with composer and conforms to psr-4.
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.
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.
Usage
Resolving a URL can be as easy as:
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');
统计信息
- 总下载量: 608
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-29