i need to open a text file on a remote server (linux) using php. should i use fsockopen or fopen? i understand that fopen can only work if 'allow_url_fopen' is set in the php.ini file - so is fsockopen always better than fopen? any advice at all is very much appreciated.
Both of this functions will fail if allow_url_fopen is switched off. This setting cannot be redefined with .htaccess or ini_set, so you need to have it enabled in php.ini. I think fopen is more simple than fsockopen. Also you can use the simplier function file_get_contents for file reading (PHP>=4), and file_put_contents for writing (PHP>5).
thanks for the replies... i'm the developer of a script that i distribute freely. in the control panel of the script, i'm adding code to communicate with my web server to determine the latest version of the script. i have the information stored in a text file in my web server - that's why i need to open remote files... any ideas?