Example #1
0
$file = fopen("{$tempdir}/{$filename}", "w");
fwrite($file, $_SESSION['plfile']);
fclose($file);
$file = fopen("{$tempdir}/{$filename}.ann", "w");
fwrite($file, $annfile);
fclose($file);
$output = show_annotated($filename);
if ($output[0] == 0) {
    $xml = $output[1];
    $_SESSION['annerror'] = '';
} else {
    $_SESSION['annerror'] = $output[1];
    redirect('upload.php');
}
delDir($tempdir);
$prefs = get_preferences();
if (!isset($prefs['display']) || $prefs['display'] == 'horiz') {
    ?>
<table width="100%">
<tr>
<td align="center">
<span class="paneheading">Source Code</span>
</td>
<td align="center">
<span class="paneheading">Filters</span>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<div class="codeframe" id="sourcebox">
<?php 
function get_data($url)
{
    $header = array('Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3', 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Connection:keep-alive');
    $preferences = get_preferences();
    $cookie = 'preferences=pl=' . $preferences['language'] . '&pc_eu=' . $preferences['currency'] . '&ps=eu ';
    // initialise the CURL library
    $ch = curl_init();
    // specify the URL to be retrieved
    curl_setopt($ch, CURLOPT_URL, $url);
    // Header HTTP
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    // Follow Redirect
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    // specify the useragent: this is a required courtesy to site owners
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.01 (compatible; MSIE 6.0; Windows NT 5.1)");
    // we want to get the contents of the URL and store it in a variable
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // Cookie
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    // Watch the header
    curl_setopt($ch, CURLINFO_HEADER_OUT, true);
    // return the contents as a variable
    $data = curl_exec($ch);
    /* Watch the header for DEBUG
    		$headerSent = curl_getinfo($ch, CURLINFO_HEADER_OUT); 
    		echo $headerSent;
    	*/
    // free resources
    curl_close($ch);
    return $data;
}