Wade, Do us a favor of conserving mailbox real-estate by consolidating your replies into a single email.
Okay, when you run into PHP problems, www.php.net will become your best friend. I went to www.php.net and typed fopen in the search box. This page came up, complete with code examples on how to use fopen: http://www.php.net/manual/en/function.fopen.php Don't use file() in the case of your code, because your code relies on fopen() returning a file-handle (if you don't know what that is, Dr. Google does) rather than an array like file() will return. Your sample code appears to be wrong also in that $filename is not a www URL but a local file name. Change it like so to point to the file on the web server: $filename = "http://virtual1.example.com/data/directory.data"; or wherever the file /really/ resides. Judging from your questions, it's time for you to get intimate with a good PHP tutorial. _Programming PHP_ is a good start, but Ryan Bird's tutorial (mentioned in a previous post) is a great, free resource. The PHP folks have one on php.net also that is excellent: http://www.php.net/manual/en/tutorial.php Read them. Learn how PHP works, and then come ask us questions when you get stuck. PHP put together the best documentation in the world to provide people learning PHP with a fast, easy resource for figuring it out. It has never let me down. Sometimes it's hard to learn a new language by jumping in to someone's big application. So, get the basics down by reading those tutorials I pointed out, and write a couple of your own little scripts that use fopen() (and anything else) to figure out how it works, then come back to us when you get stuck. We'll be happy to help. --Dave <quote who="Wade Preston Shearer"> > i don't need to write to it... just read it > > how to i set it up to "allow urls in fopen" ? > > > On Wednesday, February 26, 2003, at 08:06 PM, Andrew Jorgensen wrote: > >> That really will kill the purpose of having a database anyway. You >> won't be able to write to the remote file, especially not if there's >> another system writing to it. Of course read-only will work okay if >> you allow urls in fopen and you have the right libs to do so. >> >> Phillip Hellewell wrote: >>> I'm not a PHP expert, but I would say >>> http://virtual1.example.com/data/directory.data >>> is NOT a file. You cannot access it as if it were a file. It is a >>> file >>> on a remote server. To access a file across a network or an >>> internet, you need to fetch the file in some way. You can't do that >>> with a simple >>> fopen. You need curl library or something that will let you connect >>> to >>> a remote server and download a file, like what wget does. >>> Phillip >>> On Wed, Feb 26, 2003 at 04:01:59PM -0700, Wade Preston Shearer wrote: >>>> i have a script, on... >>>> virtual1.example.com >>>> >>>> ...that reads a flat-file database... >>>> /data/database.data >>>> >>>> which works quite well. >>>> on... >>>> virtual2.example.com >>>> >>>> i put the same script, but didn't want to manage two copies of the >>>> same database, thus killing the point of having a database. so, >>>> instead of putting... >>>> $filename ="data/directory.data"; >>>> >>>> ...in the top of the script, i put... >>>> $filename ="http://virtual1.example.com/data/directory.data"; >>>> >>>> ...but it didn't work. i'm guessing that there are some security >>>> things are prevent this or something, but am not sure. do i not have >>>> the syntacs correct? >>>> -wade preston >>>> >>> ____________________ >>> BYU Unix Users Group http://uug.byu.edu/ >>> ___________________________________________________________________ >>> List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list >> >> >> ____________________ >> BYU Unix Users Group http://uug.byu.edu/ >> ___________________________________________________________________ >> List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list >> > > > ____________________ > BYU Unix Users Group > http://uug.byu.edu/ > ___________________________________________________________________ List > Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list
