开发者

Intercept a request to read a particular file and instead generate the apparent output of that file read programatically

开发者 https://www.devze.com 2022-12-25 20:59 出处:网络
Sorry for the long and ye开发者_JAVA百科t still somehow vague title! A friend of mine has a Flash Action script running on a LAMP server that currently reads an xml config file. He\'s asked me if it\

Sorry for the long and ye开发者_JAVA百科t still somehow vague title!

A friend of mine has a Flash Action script running on a LAMP server that currently reads an xml config file. He's asked me if it's possible to remove the xml file, and replace it somehow with a system (lets call it an 'auto xml generator') that intercepts the request to read that file and generates an output, so it appears to all intents and purposes as if the file still exists and contains the contents that has actually been returned from our auto xml generator

Hours of Googling has failed to come up with any promising leads, can anyone offer any advice?

Thanks very much!

Mike


Sure. Your friend could instead point the download at a PHP script that generates an XML file automatically.

This link from IBM looks promising as a starting point if this is unfamiliar teritory.


This could be implemented via FUSE (Filesystem in Userspace) if the host supports it. When mounted, have it show a single .xml file which would (conceivably) return a unique view of data to every reader.

Its not 'intercepting' system calls, open() works as normal. Its the underlying file system that understands and provides the magic.

The link is to what's needed for a PHP implementation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号