PHP code example of infusionweb / laravel-url-resolver-provider

1. Go to this page and download the library: Download infusionweb/laravel-url-resolver-provider library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

infusionweb / laravel-url-resolver-provider example snippets


'providers' => [
    //
    InfusionWeb\Laravel\Providers\UrlResolver::class,
];

'aliases' => [
    //
    'Resolver' => InfusionWeb\Laravel\Facades\UrlResolver::class,
];



use Resolver;

$url = 'http://bit.ly/1R6M0uY';

$resolved = Resolver::resolveURL($url)->getURL();



use Resolver;

// Change the default user agent.
Resolver::setUserAgent('Mozilla/5.0 (compatible; YourAppName/1.0; +http://www.example.com)');

// Set a temporary file for session cookie storage.
Resolver::setCookieJar('/tmp/url_resolver.cookies');

// Test result object for additional information.
$url = 'http://goo.gl/0GMP1';
$url_result = $resolver->resolveURL($url);
if ($url_result->didErrorOccur()) {
    print "Error resolving $url:\n  ".$url_result->getErrorMessageString();
}
else {
    print $url_result->getHTTPStatusCode().': '.$url_result->getURL();
}