PHP code example of rhincodon / utm-url-parser
1. Go to this page and download the library: Download rhincodon/utm-url-parser 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/ */
rhincodon / utm-url-parser example snippets
php
$utmUrl = 'http://test.com/test?utm_source=bing&&utm_medium=cpc&utm_campaign=rolex&utm_term=rolex+two';
$parser = new \Rhinodontypicus\Parsers\UtmParser();
$utmString = $parser->parse($utmUrl);
if ($utmString->isValid()) { // true
echo $utmString->source; // bing
echo $utmString->medium; // cpc
echo $utmString->campaign; // rolex
echo $utmString->term; // rolex two
}