fopen converting

fopen converting

Posted by: nukemars
Posted on: 2006-01-30 16:31:00

How would I convert this for php command fopen to a curl command? I don't programming, I just read in the forums that fopen is turned off on dreahost servers. Any help would be great.

	$myfile = @fopen($filename, "w ")or die ("Couldn't open configfile ($filename). Check the path to webroot to be correct. Check permissions for 
directory and files incsite to be set to 777.");
@fwrite($myfile, $newstring) or die("Problem creating config file. Check permissions for directory incsite and files to be set to 777.");
fclose($myfile);


and

	$myfile = @fopen( $filename, "w " );
@fwrite($myfile, $newstring) or die( "Problem creating effect.txt file ($filename). Check permissions for directory files to be set to 777." );
fclose($myfile);



This is the file I'm tring to fix.

Thanks

-NM

Re: fopen converting

Posted by: scjessey
Posted on: 2006-01-30 17:20:00

In reply to:

I just read in the forums that fopen is turned off


fopen is not turned off. URL access is. As long as you use relative paths within your own domain (not http:// etc), everything will be cool.

Re: fopen converting

Posted by: silkrooster
Posted on: 2006-01-31 16:46:00

Here is a read function that works for me. Odds are some of it is not needed. I am just learning myself and one thing I learned a long time ago about computers whether it is a program, or a programming language, odds are good there are more than one way to accomlish the same thing.
Silk

IO ($filename=$filename, "r");
function IO ($filename, $io) {
$channel=curl_init($location);
$file=fopen($filename, $io) or die($php_errormsg);
curl_setopt($channel, CURLOPT_FILE, $file);
curl_setopt($channel, CURLOPT_HEADER, 0);
curl_setopt($channel, CURLOPT_NOBODY, 0);
curl_exec($channel);
$data=strip_tags(fread($file, filesize($filename)));
curl_close($channel);
fclose($file) or die($php_errormsg);
print "<div><hr><p class="view">View of created document...</p><h1 class="data">$data</h1></div>";
}


Tags: fopenwebroottxt filefwritefclosetringpathservers