PHP can run also in command line: http://php.net/manual/en/features.commandline.php
But, if you install PHP 5.4.0 you get also a webserver, just run:
php -S localhost:8000
from the directory with the files to test and you can browse them. Said this, with every programming language you can open a socket and serve data. If there is a problem with restrictions, why not setup a firewall in the working station and block the ports?
cereal
Veteran Poster
1,196 posts since Aug 2007
Reputation Points: 358
Solved Threads: 232
Skill Endorsements: 22
You could use javascript. Honestly. Just use an invisible iframe to serve as the go-between for retrieving file content.
<html>
<head>
</head>
<body>
<iframe style="display:none;" id="myIframe" src="/pathtofolder/textfile.txt"></iframe>
<a href="#" onclick="getContentFromIframe('myIframe')">Get the content</a>
<div id="display"></div>
<script type="text/javascript">
function getContentFromIframe(iFrameName){
var myIFrame = document.getElementById(iFrameName);
var content = myIFrame.contentWindow.document.body.innerHTML;
document.getElementById('display').innerHTML = content;
}
</script>
</body>
</html>
You can use another function to change the src attibute value (i.e. change file). Again you don't need a link, you could use a dropdown which loads data (particular file) as you change the value.
For added goodies, you could use the jQuery and jQueryUI and rerlated CSS CDN references (e.g. from Google) to really spark up your site - no server required. Alternatively, download them and use them locally.
I don't know how useful that is?
I got the bare-bones script from here:
http://roneiv.wordpress.com/2008/01/18/get-the-content-of-an-iframe-in-javascript-crossbrowser-solution-for-both-ie-and-firefox/
However, writing to files is another matter - I'm not sure that this is do-able with js
From what I gather, it can only be done via ActiveX (IE) using fso. But this IMO could be a security issue if the site was open to the wild, ie accessible to others. But there again if somebody got into your computer, they'd do enough damage without trying to mess with your files through a webpage.
//EDIT
Just checked:
<html>
<head>
<script>
//this can be put into a function
var fso = new ActiveXObject("Scripting.FileSystemObject");
FO = fso.OpenTextFile("C:\\diafol.txt", 2, true,0);
FO.write("See if this works");
FO.close();
</script>
</head>
<body>
<p>Just some random text - could be used to report on file handling progress / reponse</p>
</body>
</html>
This works for me under Internet Explorer - although you may need to allow ActiveX and scripts to run in the browser. So you could use this as opposed to the iframe nonsense.
diafol
Keep Smiling
10,839 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,536
Skill Endorsements: 61