84 lines
1.7 KiB
PHP
84 lines
1.7 KiB
PHP
<?php
|
|
include_once("classes/class.parserutility.php");
|
|
require_once('data-ripper.php');
|
|
|
|
$page = $_REQUEST["page"];
|
|
|
|
|
|
|
|
function normalizeUrl($url) {
|
|
$parts = parse_url($url);
|
|
return $parts['scheme'] .
|
|
'://' .
|
|
$parts['host'] .
|
|
implode('/', array_map('rawurlencode', explode('/', $parts['path'])));
|
|
|
|
}
|
|
|
|
if(ParserUtility::parse_host($page)=='ny.milesplit.com')
|
|
{
|
|
if(mySplitUrlType($page)=='RAW')
|
|
{
|
|
//echo 'RAW';
|
|
echo milesplit($page);
|
|
}
|
|
else if(mySplitUrlType($page)=='FORMATTED')
|
|
{
|
|
//echo 'FORMATTED';
|
|
$rawUrl = convertMysplitFormattedtoRaw($page);
|
|
echo milesplit($rawUrl);
|
|
}
|
|
else if(mySplitUrlType($page)=='DRILL-DOWN'){
|
|
|
|
//echo 'DRILL-DOWN';
|
|
echo mysplitdrilldrowncase($page);
|
|
|
|
}
|
|
}
|
|
else if(ParserUtility::parse_host($page)=='www.just-in-time-racing.com')
|
|
{
|
|
|
|
|
|
echo just_time_in_racing(normalizeUrl($page));
|
|
|
|
|
|
}
|
|
|
|
function mySplitUrlType($url)
|
|
{
|
|
$expld = explode("/",$url);
|
|
$itemOfInterest = $expld[count($expld)-1];
|
|
$expldItemOfInterest = explode(".",$itemOfInterest);
|
|
switch(strtolower($expldItemOfInterest[0]))
|
|
{
|
|
case "raw#":
|
|
return 'RAW';
|
|
break;
|
|
case "formatted#":
|
|
return 'FORMATTED';
|
|
break;
|
|
case "results#":
|
|
return 'DRILL-DOWN';
|
|
break;
|
|
default :
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
function convertMysplitFormattedtoRaw($url)
|
|
{
|
|
$expld = explode("/",$url);
|
|
$itemOfInterest = $expld[count($expld)-1];
|
|
$expldItemOfInterest = explode(".",$itemOfInterest);
|
|
if(strtolower($expldItemOfInterest[0])=='formatted#')
|
|
{
|
|
$expld[count($expld)-1] = str_replace("formatted","raw",$expld[count($expld)-1]);
|
|
return implode('/',$expld);
|
|
}
|
|
else
|
|
{
|
|
return $url;
|
|
}
|
|
}
|
|
?>
|