Allowing file() for just one website on a shared server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zzapper
Forum Newbie
Posts: 2
Joined: Wed Nov 12, 2008 6:47 am

Allowing file() for just one website on a shared server

Post by zzapper »

Hi
I need to use the file() function to read information from a remote url. file() is however not allowed on that particular server. The Hosting company is quite willing allow it for my website but doesn't want to enable it server wide. What options are available? Are there add-ons , alternatives to file(), a .htaccess trick etc etc?

Server: Apache/1.3.41 (Unix) mod_ssl/2.8.31 OpenSSL/0.9.8g PHP/4.3.1 mod_throttle/3.1.2 mod_gzip/1.3.26.1a
Thanks
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Allowing file() for just one website on a shared server

Post by josh »

fread()
zzapper
Forum Newbie
Posts: 2
Joined: Wed Nov 12, 2008 6:47 am

Re: Allowing file() for just one website on a shared server

Post by zzapper »

Hi Jsh
In fact the service provider is moving us to a PHP5 server where file() is allowed (Because security has been improved in php5?). But can I do the same things with fread()?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Allowing file() for just one website on a shared server

Post by pickle »

file() is just an easy way to pull each line from a file & put it in an array. You can duplicate that with fopen(), fread(), fclose() and some fancy logic, but if file() is available, definitely use it.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Allowing file() for just one website on a shared server

Post by josh »

If you don't need to read the whole file, using fread and explode() would be better to create the array, or if file() isn't available you seem to have no other choice
Post Reply