DreamHost Web Hosting
Discussion Forum


Forums
   >> General Troubleshooting
*Threaded Mode

Subject fopen converting  
Posted bynukemars (DH Dreamling)
Posted on01/30/06 04:31 PM



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



Subject Re: fopen converting new [re: nukemars]  
Posted byscjessey (DH Grizzled Veteran)
Posted on01/30/06 05:20 PM



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.

----------------
Simon Jessey
Keystone Websites | si-blog

Subject Re: fopen converting new [re: nukemars]  
Posted bysilkrooster (DH Enthusiast)
Posted on01/31/06 04:46 PM



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>";
}





*Threaded Mode
Jump to