(function() {

// MAXB.NET LABS

})();

hack, php

Proxy php vs Websense

Posted on by Massimiliano Balestrieri | Comments

Se siete in una intranet e avete un proxy aziendale malefico tipo websense potreste avere problemi di cache oltre che di contenuto proibito!

Ecco come nel mio wiki aziendale riesco a prendere il feed di dilbert (la mia vignetta quotidiana di dilbert era ferma al 10 Maggio!):

* chiaramente questo proxy è implementato per trasmettere feed xml. non altro.

header('Pragma: public');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");                  // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');     // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0');    // HTTP/1.1

header ("content-type: text/xml");

$params = array (
    'http' => array (
        'proxy' => 'tcp://proxy.azienda.it:80', // This needs to be the server and the port of the NTLM Authentication Proxy Server.
        'request_fulluri' => true,
        'header' => 'Cache-Control: no-store, no-cache, must-revalidate',
    )
);

$ctx = stream_context_create($params);
if(isset($_REQUEST['url'])){
    $url = $_REQUEST['url'];
    echo file_get_contents($url, false, $ctx);
}else{
    echo '<?xml version="1.0" encoding="UTF-8"?><nodata>1</nodata>';
}

exit ();

This entry was posted in hack, php and tagged , , , , . Bookmark the permalink.

One Comment

  1. Posted 11 June 2008 at 08:44 | Permalink

    Io per l’ultimo
    http://perassi.org/2007/07/28/a-dilbert-plugin-for-dokuwiki/
    ho usato le API interne di DokuWiki
    ovvero
    http://dev.splitbrain.org/reference/dokuwiki/nav.html?inc/HTTPClient.php.source.html
    e non ho avuto problemi dietro websense