PHP & MySQL | Tutorials

David Carr

PHP read file from network drive

I’m working on a local hosted project where php needs to read a text file that’s stored on a network drive and is not directly accessible with a php script or so I thought.

Turns out with the correct network path a regular file_get_contents is all you need to grab files located over a network drive. In the example below I’m calling a txt file located on a z drive.

file_get_contents('file:///z:/Desktop/contacts.txt')

 For this to work the php server needs to be running on the same network you’re trying to access.

Domains are often purchased from multiple providers, keeping track of where a domain is and its DNS settings can be tricky. Domain Mapper solves this by listing all your domains in one place. View your DNS settings and receive reminders to renew your domains. Try it today.

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2009 - 2021 DC Blog. All code MIT license. All rights reserved.