Writing Files To Local Machine
Does anyone know how to, using PHP or other, to automatically write files from a mySQL database on a server to a local machine? Basically the reason I need it, is that the database will be continually getting new data from various users, and I want the information to be copied to a local file on my own computer every 15 minutes or so (just continually rewriting the file on my local machine, with the newest data). This way, if there is a server error, or internet connectivity issues, I will still always be able to access the latest data by opening the file on my local machine.
View Complete Forum Thread with Replies
Related Forum Messages:
PHP On Local Machine
Back in 2004 I installed PHP, Apache and MySQL on my local machine to do some testing. I have not used it since. I just tried to browse one of my .php test files in IE and it opened up in Dreamweaver! Everything seems to be in place where I left it, I restarted Apache just in case - but no joy. Is there something simple that I have forgotten to do? - something I should have started up? - or something I can check? I would like to avoid reinstalling the software if possible as I recall having a few "teething problems."
View Replies !
PHP Copy To Local Machine?
I am building a small page to copy files from our server(s) to our users local machines. It's very simple... (below, "f" is a mapped network drive) <?php $source_file = 'f:somefile.whatever' $destination_path = (I want to move it to the USERS C:somedirectorysomefile); copy($source_file, $destination_path); ?>
View Replies !
Getting Unlink() On My Local Machine
I am having trouble getting unlink() to work on my local machine (win 2000, Apache, php 4.2.2) when I invoke unlink() in order to change a file name during a 'picture edit' change from a form upload on my local machine using simple stuff like: <?php if(file_exists($new_file_name)){ unlink($new_file_name); } if($new_pic){rename($old_file_name,$new_file_name) ;} } ?>........
View Replies !
Local Machine Time
Echoing <?php echo date('Y-m-d h:i:s'); ?> seems to give the server time. Is there a way to echo the local machine time of the user/by time zone? The user is entering values based on the time (this is a web based calendar). Currently, the above could be a max. of 2 hrs off for users in the United States, in may case.
View Replies !
Accessing Mail On Local Machine
This is probbly not a php question but here goes: I recently installed cyrus-imapd. The imap server is up and running, I am able to login but it says that I have no mail but if i use pine I am able to see all my messages.
View Replies !
$_FILES From The Server - Not Local Machine
I'm just playing with someone else's code and was wondering how to get details of a file that's already uploaded to my server into the $_FILES super global. the code I have is: ...$uploadedFileName = $_FILES['filename']['name']; if($_FILES['filename']['size'] > $maxSize) {... all the checks are done using this and I just want to parse all this info without the user having any control / knowledge of it at all. It's for an image upload script which has been built already, but I want lots of differing quality thumbnails to be generated, but the current code keeps asking the user to input size variables and path details to upload a file from their local machine.
View Replies !
How To Get Data From A Database To My Local Machine?
I have a process that runs on my local machine which requires information from a database to be used in a dos batch file. Currently, I have a setup where a query string is sent to the web server with the id number of the record I want to get and a page on the web server writes a file to the server which is then downloaded using httpget to be used by the batch file. Is there a better way to do this? In other words, how can I have a dos batch file interact with the database directly to get the info in the record?
View Replies !
Backing Up The Database On Local Machine.
I'm currently getting on with the security checking of my site, but how about backing up the database. Currently I'm using a hosted service, so all my data and code is on the internet. I have only one database online with multiple tables, so I need to put them somewhere (on an daily basis preferably, with new backups each day). The code I can handle it's just the databases that are tricky. Is there any tool out there that'll do this quick and smart and would I need a local MySQL database running in order to put them on a local machine.
View Replies !
Test CRON On Local Machine (WAMP)
How could I test-run a CRON on a local machine? Com-line or Putty does not find local host or 127.0.0.1 I never tried that before so I am clue less! don't even know if it is possible? How can I manage it on a local machine/localhost run by a WAMP
View Replies !
Printing To Local Machine For The A Remote Site
I would like to find out if I can get a page to print on a printer physically next to the server when a user of my site clicks the submit button. I'm sure that there's a way, but being new and slightly slow I'm not sure where to even begin looking.
View Replies !
Copying File From Hosted Remote Sever To Local Machine
I am trying to use php to automate the copying of a file from my remotely hosted directory to my computer. I have put together the following but it will only do the copying from one directory to another on the remote server. Reading the postings on these functions they suggest that it can be done but it appears to be the case if your are hosting your site on the same machine you want to copy the files to. Does anyone know if there are functions in php to do the transfer from remote server to my machine or if the code below will acheive this with modification? <?php $ftp_server = "xxxxxxxx"; $ftp_user = "xxxxxxx"; $ftp_pass = "xxxxxx"; $local_file = 'myfile.txt' $server_file = 'myfile.txt' // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass); // check connection if ((!$conn_id) || (!$login_result)) { die("FTP connection has failed !"); } // try to change the directory to myfilesdirectory if (ftp_chdir($conn_id, "myfilesdirectory")) { echo "Current directory is now: " . ftp_pwd($conn_id) . ""; } else { echo "Couldn't change directory"; } if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo "Successfully written to $local_file"; } else { echo "There was a problem"; } // close the connection ftp_close($conn_id);
View Replies !
Writing To A Local File
We have a PHP/MySQL database application. A user would like to be able to run a routine to read selected data from the database and export a flat file to their local C: drive. After reviewing the documentation and posts, it is not clear how to do this, or even if it is allowed by the browser. If someone could point us in the right direction, we would greatly appreciate it. The application is hosted on a Linux server. The users are required to use Internet Explorer running on Windows 2000 or XP (we also use VBScript).
View Replies !
Writing A Local XML File From A Parsed URL? Similar To RSS
I am trying to pull the XML data from the following stream: http://......and write it to a local file. Actually, what I would like to do is take the above stream and display it into a website... much like displaying RSS feeds on a webpage. I looked at javascript, but someone there pointed me to the PHP group. I may not have worded the subject correctly.
View Replies !
MDB Files On Linux Machine
My Boss want me to put access database file on linux machine and access them from the same machine using php. Can I put Access (.mdb) files on linux machine ? what is simplest method available to use them from php ?
View Replies !
Multiple Local PHP Files
I'm making a page using PHP, and including varios files for navigation bars and such.. However, my problem is that I can't include multiple PHP files locally. After including the first one, everything after that has to be an html include, or a remote php include. PHP Code: <?php echo <<<BEGINHTML <html> <head> </head> <body> BEGINHTML; //This will print include("banner.htm"); //As will everything from here to echo " ##Printed banner ";.....
View Replies !
Viewing WordPress PHP Files On Local PC
I am looking for a way to open WP's files on my local machine that will allow me to view them "in a clean" - line by line - way. In other words, I'd like to view the code in a way that I could begin to understand the step-by-step logic of the code. What is the trick, if any, that might allow me to somewhat unscramble the code? Code:
View Replies !
Writing To Files
I made a form and when the user submits the form it writes what they submitted in a .txt file. However everytime someone puts in something new it just rewrites over what was in the .txt. I know that when you open a file for write mode it clears all contents, but how do those PHP news managers work? They keep writing to one file (example:news.txt). I want to just keep adding into the same .txt file without losing whats already in there. Can this be done?
View Replies !
Writing CSV Files
I desperately need some help with writing data to a CSV file in PHP. I've scoured the 'Net for information/help about how to go about doing this, and have not had a single bit of luck finding anything!
View Replies !
XML Files Writing
I am soon going to be looking to write XML files with php, I think it has to be written in a certain encoding or would the simple writing functions do ? such as touch() fputs fgets all that jazz or do i need to use some special function which will write in a certain encoding ?
View Replies !
Parsing HTML Files On Local Computer
I would like to be able to open and read HTML files that are on my local (client) computer and then parse them to extract some specific information they contain. I've been looking here and reading my PHP books, but it appears to me that PHP only opens files on the server or URLs. It think that makes sense to me. Is there an alternative?
View Replies !
Link To Local Files Through A Dynamic Page
I decided to flesh out my php skills by building a web application which could scan through local files on my intranet (specifically mapped drives on my server) and generate a list of Movies or pictures or music, etc. Which worked fine, I created the code to do that and to store the results in a mysql database. I can even print it out to a ..php page and sort it however I like. What I can't seem to do is to create links to the data I've indexed in a way that will let me open them from the generated php page. I've searched and searched and there just doesn't seem a way to do this. I'm pretty sure I've exhausted the obvious options. The following trials did not work when the document was served from an apache web server. <?php echo "<h1><a href=file:///c:/temp.txt> HEY </a></h1>"; echo "<h1><a href=file:///c: emp.txt> HEY </a></h1>"; ?> <a href=file:///c: emp.txt target="_top"> temp.txt </a> <a href=file:///c:/temp.txt target="_top"> temp.txt </a> When the same page was loaded directly from the file instead of served through apache the bottom two links worked. This doesn't really help me however. I need to be able to dynamicly generate pages that link to the files. I've read that browser security is the restricting factor in this but changing all of my security settings in IE to low didn't seem to affect it (not sure what the equivalent of security settings is in Firefox). Does anyone know of a way to link to local files directly in a way that lets you open them directly from the source instead of by downloading them to a temp file or saving the file to somewhere locally? Is it even possible in PHP?
View Replies !
Writing Files And Permissions.
If Apache is running as the user "www" and "www" is part of my group "wheel" should'nt i be able to create files with php in a directory that has the permissions of 0775? It seems i always need to make the directory 0777 to write to it, which doesnt seem right.
View Replies !
Reading And Writing Files In PHP
I have a question about how PHP handles multiple file reads/ writes. I made a page containing a self-submitting form where the user can type his name, topic and a text. When he submits the form, PHP reads the .php file in a variable. It then processes it: adds the user comments to the var and writes the modified file back to disk. Next time the user opens the page (s)he sees te comments (s)he and others added. So what I have is a very simple 'Blog' without using a database. The ..php file is modifying itself every time a user submits something....
View Replies !
Writing To Files That Are Not Public
I'm running a script that reads and writes to a file. The problem is that in order to read and write to this file I need to set the public permission to read and write. As understand the reason is that the script is running with apache id,however the file (which I uploaded using an FTP) has a different group and user id. First of all am I right? is this reason, is there a way to solve this problem (I do not have a ssh connection to my server, so I can't change the id).
View Replies !
Writing Files To A Directory
How do i write files to a directory? i can only figure out how to make the site open files in the same directory as as the script file, is there osme way to tell it to read or write a directory? say in /files/?
View Replies !
Reading/Writing Txt Files
if i have a txt file that looks like... $news=this is the news bla bla& $bio=bla bla bla bla& $contact=bla bla bla bla& how can i just replace the text of one of these lines without touching the other lines? i will be using a form to submit the new data, and the lines in the text file must start with &varname= and end with a & also, i want to convert any & symbol within the text that is submitted from the form to %26 .
View Replies !
Problem Writing Files
i have working perfectly with file creating and file writing on my computer with php script(win2k). but i have problem when i uploaded to my web host (probably there were using linux) i got an error warning fwrite(0: supplied argument is not a valid steam resource in /home/er/public_html/games/install.php on line which i think it have something to do with the chmod. (file permission) i am newbie, i would like to ask any of you, how should i fix this?
View Replies !
Writing To Text Files..
I myself, have NEVER in my php career used flat files for anything..but today i broke down, figuring it would be to much stress on the database for what I want, I decided to create a "log" file on the server and make a script to write all the information about every users click I need to the proper file. Code:
View Replies !
Reading / Writing Files
i'm trying to read / write a file, and am having some problems... here's the php script i'm trying to read / write with: <? $fp = fopen("test","r+"); while (!feof($fp)) { $temp=fgets($fp); if ($temp == "4 ") fputs($fp,"###"); } fclose($fp); ?> the contents of test are as follows: 1 2 3 4 5 6 7 8 9 0 now, i would expect 4 to either be replaced by ###'s, or for ###'s to be added after 4. however, no such thing happens, and i'm not sure why. any ideas? also, if you can only read, or you can only write (which is the best explanation i can come up with, atm, for the above code not working), then what's the point of having modes that support both?
View Replies !
Download Files From Remote Server To Local Webserver
I am trying to create a php page whereby people can download files from a remote server to their own server (to update their webdirectory with updated files/images etc). So for example one php page (e.g. update.php) should be able to download files from a remote server to a specific directory on their local webserver. Is this possible?
View Replies !
Hyperlink From Intranet Web Page To Local Files On My Computer
I'm creating a company intranet, and every employee has certain program we want them to be able to run from it, meaning we want the link to the program to be on the intranet page. For example, Adobe Photoshop resides on all the employees computer under "C:Program FilesAdobePhotoshop 7.0Photoshop.exe" However, when I enter that as a hyperlink on the page, it does not run the program. Is there a way to get a web page to run a program on the local host?
View Replies !
Problems Uploading Files Using Apache And Php On A Local Windows PC.
I've got some problems uploading files using apache and php on a local Windows PC. I'm using the file upload example from the manual, but i can't get it to work. I don't get an error message, it's asif nothing happens. I can't find the file that should be uploaded on my harddisk. Has anyone a working example for file-uploads on a local server with the settings for the php.ini file? Any tips?
View Replies !
Writing Files; Ownership Problems
I've created an online "image manager" app for our web design clients that allows them, when logged in; to be able to upload images to a directory assigned to them, to be able to view the images, and then delete them if they wish (it's part of a wider app for our clients who wish to edit their own web pages). To automate the process of adding users to the system, I've created a script that enables us to add a new user to the system, and it issues a mkdir to automatically create the new directory and chmods it to give write permissions (previously the directory was created manually either in FTP or via SSH). Then the user can log in, view the contents of their directory, and upload images if they like. The problem I'm having is that when a user whose directory has been created using this new system uploads an image, the file size created is 0 bytes. Yet this does not happen with the old directories that were created manually. I think this must be something to do with the ownership of the directories. The owner of the old directories is root and the new directories are set as owned by apache. The Image Manager script can see the new user's directory and appears to want to save the image there, but like I said it just creates a 0-byte file, whereas when logged in as an older user, it receives the upload and saves it correctly. Has anyone got any ideas as to why PHP might be doing this? I have already turned Safe Mode off, as this was causing me problems before with PHP balking at not being allowed to access a directory since it did not have the same script uid as the original script that created it. I can't get PHP to change the owner of the directory because it doesn't have permission to change it... any suggestions anyone? I'm rather desperate and this is my last resort! If there's anything I haven't made clear please just say and I'll clarify. Thanks!
View Replies !
Is There Something Similar To Printf For Writing To Files?
Is there something similar to printf for writing to files? Right now, my code is this function PrintEmployees($input_array) { while(list($index, $value) = each($input_array)) { printf ("%s (%s) %.2f <BR>n", $value[0], $value[1], $value[2]);}} But instead of printing to the browser, I want to write the same output to a file. How do I do this? Can it be done with fputs?
View Replies !
Includes And Writing To Text Files
i have 6 scripts, each writing to a text file. in addition, i have an index file with links to all the text files that includes all of these scripts. the problem is that the index file will run one script off the include list and then stop. it's incredibly bizarre to me and i'm not sure why it's happening.
View Replies !
Writing Files To A Choosen Directory
I have the following code which changes directory, creates a file and then writes rows to it. It works fine except the file is created in the folder the php script is in instead of the download directory specified in the scrip. Can anyone see where I have gone wrong Also I want to show the question Index and Question on screen as a list. Ive put echo $nt['QuestionIndex'], $nt['Question']; ****************************** $query= "SELECT * FROM Questions WHERE NCIndex='".$_SESSION['NCI']."' AND QuestionIndex IN (".join(",", $_SESSION['questions']).") ORDER BY QuestionIndex"; $rt=mysql_query($query) or die(mysql_error()); echo mysql_error(); if (ftp_chdir($conn_id, "../htdocs/Downloads")) { echo "Current directory is now: " . ftp_pwd($conn_id) . " "; }else { echo "Couldn't change directory "; } $fp = fopen('ptq'.$_SESSION['username'].time().'.txt', 'w') or die('Could not open the text file for writing'); while ($nt = mysql_fetch_array($rt, MYSQL_NUM)){ $line = "INSERT INTO tQuestions VALUES ('', '" . implode("', '", $nt) . "'); "; fwrite($fp, $line); echo $nt['QuestionIndex'], $nt['Question']; <<<<<<<<<<<<<<< } fclose($fp); ***************************
View Replies !
Writing Queries To Text Files
I have done this several years ago...but cannot remember where I got started. I have three pages: an input page, search page, and removal page. I am wanting to have one logfile that whenever a query is executed on any of those pages, it automatically ammends the information to a new line in a text file. I know about the fopen thing, but here are my few questions I have. I just need to know how to add on to the file and not replace what is currently in. Second, how would I get it return the IP Address in like a name format (i.e. 216.109.112.135 returns yahoo.com).
View Replies !
Writing Files In A Non Public Directory
I am trying to create a file in a non public directory without success, please help me to solve it. In /home/httpd/vhosts/domain.com/httpdocs/ which is: drwxr-x--- 7 user general 1024 Feb 8 20:17 httpdocs I made a script named do_sendsecret.php which is: -rwxrwxrwx 1 root root 1885 Feb 9 11:05 do_sendsecret.php Where I am trying to create a file in /home/httpd/vhosts/domain.com/tmp/ which is: drwxrwxrwt 2 root root 1024 Nov 1 2005 tmp The code is:
View Replies !
Writing Text Files, Encoding
I am creating some text files on a local machine, mac os x, using PHP and apache, however after manipulating the files, they are unreadable by certain applications, If i open these files in word for instance then save them as txt files, they then read fine, I believe it is something to do with ascii formats.
View Replies !
Writing ITPC Codes To TIFF Files..
Can anybody direct me to a site where this is explained. I guess I'm looking for a somewhat more in depth description of the iptcembed function, which is somewhat poorly documented in the PHP manual :).. The reason why I'm asking this, is that I convert my pictures from RAW into TIFF and then transfer them to a stock site, and being able to add the IPTC info in the TIFF-file would be very handy..
View Replies !
Writing PHP Files On The "fly"
Can anyone advise me of a method to have a file written in php on the fly from a mySQL database? Context: We are developing a content management system with PHP/MySQL and are working on some enhancements. We would like to emulate the tricks of cold-fusion which one of our developers knows how to use to accomplish this with. Is there a way to assemble data in a template style method but have it written to an actual page ie. thispage.php as opposed to using a dynamic url ie. .com/viewpage.php?folder=1,file=5,type=6 or whatever? If there is an existing resource where I can read about how this is done, etc. That would also be a fine answer.
View Replies !
LOAD DATA LOCAL INFILE - Workaround For Local-infile=0
I'm using a PHP script for updating my database which relies on the "LOAD DATA LOCAL INFILE" command. As my provider recently updated the MySQL-database, he changed the "local-infile" setting to zero, i.e. my update-script doesn't work anymore (=> "The used command is not allowed with this MySQL version"). Is there a work-around to fix this problem? I though about the mysql_options command, but to frankly speaking, I have no clue how to use it and couldn't figure out how to properly use it even after reading the manual ... anyone who could help?
View Replies !
Machine Name?
is there a way to detect the name of the machine a user's on. like u would an IP. also how do i change my machine's name? =).
View Replies !
V4 And V5 On The Same Machine
We want to set up a PHP server for instructors to teach PHP, but different instructors have different needs. Is it possible to install PHP 4.3.8 *and* PHP 5 on the same machine? Perhaps using different ports or something to keep them separated? I have a Windows 2003 Server running IIS6.
View Replies !
Get Machine Name
I have a survey on my company website. I want to only allow each person to vote once a day. I can use $_SERVER['REMOTE_ADDR'] to get the IP address but we have a proxy server and that is the ip address that is showing up. Is there any other way to do this? I have been looking for a way to get the client machine name but have not had any luck.
View Replies !
Php Talk To A Fax Machine?
Is there any way I can capture data from a fax machine using PHP? I do not need a solution for faxing, I need a solution for capturing the data whenever a document is faxed directly to the fax machine.
View Replies !
|