Finally did it 
Here is how I did it...in case it may be of interest to others.
Code:
// Function to get the current page URL //
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
// $curPageURL to call for the current URL string later //
$curPageURL = curPageURL();
// Get the referrer //
$curPageReferer = $_SERVER['HTTP_REFERER'];
// If referrer is from cURL, load the template source code //
if ($curPageReferer == "SpecificReferrerNameHere") {
echo '
// Code of the whole page goes here //
';
} else {
// If the referrer is not from cURL as specified //
// Start the buffer //
ob_start();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $curPageURL); // Load the current page into the buffer //
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_REFERER, "SpecificReferrerNameHere"); // Referrer must be the same as specified above //
$contents = curl_exec ($ch);
curl_close ($ch);
// Reason I load the current page is because the template tags wouldn't be parsed as it's original value until it's been output to the browser. Therefore, this is the only method I could get the output html source code and load it into the buffer to be modified further //
// include the Simple HTML DOM Parser Script //
// Can be found here -> http://simplehtmldom.sourceforge.net //
require('php/simple_html_dom.php');
// Get the data from cURL //
$data = str_get_html($contents)
// Get the specific Div from the data //
$html = $data->getElementById("listing_details_container");
// Use Simple HTML Dom parser to remove all the empty span, div, ul, li, etc. //
foreach($html->find('comment') as $comment){
$comment->outertext = '';
}
foreach($html->find('del') as $del){
if(Trim($del->innertext) == '') $del->outertext = '';
}
foreach($html->find('span span span') as $xxxspan){
if(Trim($xxxspan->innertext) == '') $xxxspan->outertext = '';
}
foreach($html->find('span span') as $xxspan){
if(Trim($xxspan->innertext) == '') $xxspan->outertext = '';
}
foreach($html->find('span') as $xspan){
if(Trim($xspan->innertext) == '') $xspan->outertext = '';
}
foreach($html->find('li') as $li){
if(Trim($li->innertext) == '') $li->outertext = '';
}
foreach($html->find('ul') as $ul){
if(Trim($ul->innertext) == '') $ul->parent->parent->outertext = '';
}
// Output the modified HTML //
echo $html;
ob_end_flush();
};
I'm sure this isn't the best method...but it gets the job done 
Hopefully there isn't any security implications 
Again, a BIG THANKS to djr33 and traq for your precious input. 
Note: Becareful with the code above...if you happen to load the template source code while initiating cURL function to return the template source code at the same time would cause a permanent loop and would crash your server; crashed my dedicated server twice before I got it right :P
Bookmarks