note 58758 deleted from function.file-get-contents by salathe

From: Date: Mon, 21 Sep 2020 14:38:34 +0000
Subject: note 58758 deleted from function.file-get-contents by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215242@lists.php.net to get a copy of this message
Note Submitter: richard dot quadling at bandvulc dot co dot uk ---- If, like me, you are on a Microsoft network with ISA server and require NTLM authentication, certain applications will not get out of the network. SETI@Home Classic and PHP are just 2 of them. The workaround is fairly simple. First you need to use an NTLM Authentication Proxy Server. There is one written in Python and is available from http://apserver.sourceforge.net/. You will need Python from http://www.python.org/. Both sites include excellent documentation. Python works a bit like PHP. Human readable code is handled without having to produce a compiled version. You DO have the opportunity of compiling the code (from a .py file to a .pyc file). Once compiled, I installed this as a service (instsrv and srvany - parts of the Windows Resource Kit), so when the server is turned on (not logged in), the Python based NTLM Authentication Proxy Server is running. Then, and here is the bit I'm really interested in, you need to tell PHP you intend to route http/ftp requests through the NTLM APS. To do this, you use contexts. Here is an example. <?php // Define a context for HTTP. $aContext = array( 'http' => array( 'proxy' => 'tcp://127.0.0.1:8080', // This needs to be the server and the port of the NTLM Authentication Proxy Server. 'request_fulluri' => True, ), ); $cxContext = stream_context_create($aContext); // Now all file stream functions can use this context. $sFile = file_get_contents("http://www.php.net", False, $cxContext); echo $sFile; ?> Hopefully this helps SOMEONE!!!

« previous php.notes (#215242) next »