Output Just a block

Permalink
I'm trying to output just an autonav block to a page with as little header as possible so I can curl this into another web page (in another web app). Anyone have any Ideas on how to get this input? I'm using the curl web page function to grab the code:

function get_web_page( $url )
{
    $options = array(
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => false,    // don't return headers
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle all encodings
        CURLOPT_USERAGENT      => "spider", // who am i
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        CURLOPT_TIMEOUT        => 120,      // timeout on response
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
    );
    $ch      = curl_init( $url );
    curl_setopt_array( $ch, $options );

GundlachMarketing
 
hutman replied on at Permalink Reply
hutman
I would suggest using a tools file rather than a page and putting a hard coded autonav block output in the tools file.
GundlachMarketing replied on at Permalink Reply
GundlachMarketing
I created a navigation single page (in both the single pages and theme) stripped the excess out of the theme so the page was
<? defined('C5_EXECUTE') or die("Access Denied."); ?>
<html>
<head>
<?
Loader::element('header_required'); 
?>
</head>
<body>
<?
$a = new Area('Main');
$a->display($c);
Loader::element('footer_required'); ?>
</body>
</html>

Then in my file using this I used:
function file_get_contents_curl($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
$html = file_get_contents_curl("http://example.com/navigation");
//parsing begins here:
$doc = new DOMDocument();
@$doc->loadHTML($html);


Now I have 3 dynamically created nav lists working on the non c5 side of my site! Woo Hoo!