Jump to content

write text file with url


cfgcjm

Recommended Posts

I'm building a site which includes a "tip of the day" which is read from a text file. I'm making an interface which the admin can change the text through. My problem is i'm not going to have my interface files in the same directory as my textfile. Therefore i have the problem shown below because fopen() can't handle URLs. How do i specify a url to do this. Also...if the user inputs and apostrophe it is transformed to a "\" in the text file. Is there a way to fix that?

 

<?php
$data = $_POST['tip'];
// Open the file and erase the contents if any
$fp = fopen("www.digiconmediagroup.com/Homplate/tip.txt", "w");
// Write the data to the file
fwrite($fp, $data);
// Close the file
fclose($fp);
?>

Link to comment
https://forums.phpfreaks.com/topic/81075-write-text-file-with-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.