[PHP] Copy documents for another site.
Hello I create one site like document menage system and nide to take some date information from another site. The problem is a don't have access to date base. The site from who I need to take infomations use .htdacces but I have user and password for enter to site and i look the information. I write one php scripte but is not work. Do you somebody know how can I copy inflammations from this site to mine (from this site to my database) Thanks a lot and this is a php scirpte ?php $url = 'url site'; $username='user'; $password='pass'; $context = stream_context_create(array( 'http' = array( 'header' = Authorization: Basic . base64_encode($username:$password) ) )); $data = file_get_contents($url, false, $context); echo $data; echo file_get_contents(http://$username:$passw...@site/meetings/;); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy() method on objects
Here is some code: $a = new my_object; $b = $a; My understanding of this operation under PHP 5+ is that $b will now be essentially a reference to $a, *not* a *copy* of the $a object. Is this correct? There are cases where I strictly want a *copy* of $a stored in $b. In cases like this, I supply $a's class with a copy() method, and call it like this: $b = $a-copy(); Is this reasonable, or do people have a better/more correct way to do this? Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy() method on objects
On Mon, Apr 26, 2010 at 12:24 AM, Paul M Foster pa...@quillandmouse.com wrote: Here is some code: $a = new my_object; $b = $a; My understanding of this operation under PHP 5+ is that $b will now be essentially a reference to $a, *not* a *copy* of the $a object. Is this correct? There are cases where I strictly want a *copy* of $a stored in $b. In cases like this, I supply $a's class with a copy() method, and call it like this: $b = $a-copy(); Is this reasonable, or do people have a better/more correct way to do this? Paul -- Paul M. Foster I've not used it, but isn't that what clone() is for? Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy() method on objects
Paul M Foster wrote: [snip] There are cases where I strictly want a *copy* of $a stored in $b. In cases like this, I supply $a's class with a copy() method, and call it like this: $b = $a-copy(); Is this reasonable, or do people have a better/more correct way to do this? Paul http://fr.php.net/clone hth rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy Non-Text file from One Server to Another Issues
Hi, I have a simple code as shown in the following: ?php //original file $file = http://remote_server/copy/play.txt;; $file2 = http://remote_server/copy/test.jpg;; $file3 = http://remote_server/copy/sample.pdf;; //directory to copy to (must be CHMOD to 777) $copydir = .; $data = file_get_contents($file); $file2 = fopen($copydir . /play.txt, w+); fputs($file2, $data); fclose($file2); $data2 = file_get_contents($file2); $file3 = fopen($copydir . /test.jpg, w+); fputs($file3, $data2); fclose($file3); $data3 = file_get_contents($file3); $file4 = fopen($copydir . /sample.pdf, w+); fputs($file4, $data3); fclose($file4); $data5= file_get_contents(play.txt); echo $data5 . br; $data6= file_get_contents(test.jpg); echo $data6 . br; $data7= file_get_contents(sample.pdf); echo $data7 . br; ? The first one, $file, has no problems, and I did get the contents copied correctly. However, the second and third one, I get this error: Warning: file_get_contents() expects parameter 1 to be string, resource given in C:\Inetpub\wwwroot\test\hello.php on line 18 ./test.jpg Warning: file_get_contents() expects parameter 1 to be string, resource given in C:\Inetpub\wwwroot\test\hello.php on line 25 ./sample.pdf I notice that the empty file gets created correctly, but I cannot put in the file contents. If file_get_contents only supports text, could anyone please give me some suggestions on what type of function I should use to put in the file contents so that it is readable? Thanks in advance. Alice _ Use Messenger to talk to your IM friends, even those on Yahoo! http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe
Re: [PHP] Copy Non-Text file from One Server to Another Issues
On Thu, Mar 12, 2009 at 14:51, Alice Wei aj...@alumni.iu.edu wrote: Warning: file_get_contents() expects parameter 1 to be string, resource given in C:\Inetpub\wwwroot\test\hello.php on line 18 Freshman mistake. $file2 = fopen($copydir . /play.txt, w+); You're trying to read a data stream in file_get_contents() that was opened with fopen(). Don't. Instead, replace the line of code above with: $file2 = $copydir.'/play.txt'; and then RTFM on how to use file_get_contents(). -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Non-Text file from One Server to Another Issues
Date: Thu, 12 Mar 2009 14:55:52 -0400 Subject: Re: [PHP] Copy Non-Text file from One Server to Another Issues From: danbr...@php.net To: aj...@alumni.iu.edu CC: php-general@lists.php.net On Thu, Mar 12, 2009 at 14:51, Alice Wei aj...@alumni.iu.edu wrote: Warning: file_get_contents() expects parameter 1 to be string, resource given in C:\Inetpub\wwwroot\test\hello.php on line 18 Freshman mistake. $file2 = fopen($copydir . /play.txt, w+); You're trying to read a data stream in file_get_contents() that was opened with fopen(). Don't. Instead, replace the line of code above with: $file2 = $copydir.'/play.txt'; and then RTFM on how to use file_get_contents(). -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 Hi, Daniel: Thanks, it turned out that other than using your suggestion, it turned out that using copy() works great. However, is it possible for me not to use the actual physical url as I have provided in my code to access the information I intend to copy? My goal is to be able to search through the remote directory, and find the matched files of a certain format and copy it to another server. Is this possible? Alice _ Check the weather nationwide with MSN Search: Try it now! http://search.msn.com/results.aspx?q=weatherFORM=WLMTAG
RE: [PHP] Copy Function Errors
Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log in of the FTP, which neither of them worked. Both of the servers have the firewall DNS set up properly, and in my PHP info page, it appears that my FTP is enabled. Is there something else I have missed? // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/data.tar; $server_file = http://192.168.10.63/test/$id/data.tar;; // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=root; $ftp_user_pass=xx!; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); Thanks in advance. Alice -Original Message- From: Boyd, Todd M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 2:28 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form element. FTP's main function is the transfer of files (hence [F]ile [T]ransfer [P]rotocol), and is more in line with what you're trying to do here. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
It sounds to me like your problem is now about the authentication. By default most linux distributions do not give apache a password. I personally think using apache would be a bad idea. How about creating a user on the linux box your trying to put the files on to make it's primary group apache (make sure the group can write to the folder you are putting the files in) and give it a password that is a random string of 20 characters (http://www.goodpassword.com) that only your script knows. Try testing to make sure you can ftp to the server using a normal ftp client (ftp for the linux command line or http://filezilla-project.org/ is a good one if your using windows) using the account you created. Make sure you can put files in the directory you will be with the script. If this all works and your script using the new account is not, I'm sure we can help you debug it further :). Good luck! Wei, Alice J. wrote: Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log in of the FTP, which neither of them worked. Both of the servers have the firewall DNS set up properly, and in my PHP info page, it appears that my FTP is enabled. Is there something else I have missed? // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/data.tar; $server_file = http://192.168.10.63/test/$id/data.tar;; // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=root; $ftp_user_pass=xx!; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); Thanks in advance. Alice -Original Message- From: Boyd, Todd M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 2:28 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form
RE: [PHP] Copy Function Errors
It sounds to me like your problem is now about the authentication. By default most linux distributions do not give apache a password. I personally think using apache would be a bad idea. How about creating a user on the linux box your trying to put the files on to make it's primary group apache (make sure the group can write to the folder you are putting the files in) and give it a password that is a random string of 20 characters (http://www.goodpassword.com) that only your script knows. Try testing to make sure you can ftp to the server using a normal ftp client (ftp for the linux command line or http://filezilla-project.org/ is a good one if your using windows) using the account you created. Make sure you can put files in the directory you will be with the script. If this all works and your script using the new account is not, I'm sure we can help you debug it further :). Good luck! You are right, there is something terribly wrong with my authentication. I have added one user called test and gave it a fixed password. Since the information where I intend to extract from is a Linux machine, and the location where it is meant to copy to is the Windows server. I tested it using the SSH Shell from the Windows machine to make sure it is working. It does. I have modified the script where it does the authentication to the following: // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server) or die (Failed to Connect); // login with username and password $ftp_user_name=somename; $ftp_user_pass=somepass; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die (Failed to Login); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } When I executed the script, it now prompts me back Failed to Connect as in the first die statement. I am confused because when I use the SSH with Filezilla or other SFTP clients, I used the same user and passwords here and have received no errors. I don't know if I should put the user_name and user_pass from this file to the httpd.conf, though. Currently, this is not set. Thanks in advance. Alice Wei, Alice J. wrote: Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log in of the FTP, which neither of them worked. Both of the servers have the firewall DNS set up properly, and in my PHP info page, it appears that my FTP is enabled. Is there something else I have missed? // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/data.tar; $server_file = http://192.168.10.63/test/$id/data.tar;; // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=root; $ftp_user_pass=xx!; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); Thanks in advance. Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
Is there some reason that you can't use a simple samba server from the linux, to windows box? Or just do a scp copy, or just a simple ftp transfer. All of these can be done from the cmd line. Is this an exercise in creating a client app/script to accomplish this? just trying to understand a little more about what you're trying to do in transferring the files... -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2008 7:50 AM To: Sam Stelfox Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors It sounds to me like your problem is now about the authentication. By default most linux distributions do not give apache a password. I personally think using apache would be a bad idea. How about creating a user on the linux box your trying to put the files on to make it's primary group apache (make sure the group can write to the folder you are putting the files in) and give it a password that is a random string of 20 characters (http://www.goodpassword.com) that only your script knows. Try testing to make sure you can ftp to the server using a normal ftp client (ftp for the linux command line or http://filezilla-project.org/ is a good one if your using windows) using the account you created. Make sure you can put files in the directory you will be with the script. If this all works and your script using the new account is not, I'm sure we can help you debug it further :). Good luck! You are right, there is something terribly wrong with my authentication. I have added one user called test and gave it a fixed password. Since the information where I intend to extract from is a Linux machine, and the location where it is meant to copy to is the Windows server. I tested it using the SSH Shell from the Windows machine to make sure it is working. It does. I have modified the script where it does the authentication to the following: // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server) or die (Failed to Connect); // login with username and password $ftp_user_name=somename; $ftp_user_pass=somepass; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die (Failed to Login); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } When I executed the script, it now prompts me back Failed to Connect as in the first die statement. I am confused because when I use the SSH with Filezilla or other SFTP clients, I used the same user and passwords here and have received no errors. I don't know if I should put the user_name and user_pass from this file to the httpd.conf, though. Currently, this is not set. Thanks in advance. Alice Wei, Alice J. wrote: Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log in of the FTP, which neither of them worked. Both of the servers have the firewall DNS set up properly, and in my PHP info page, it appears that my FTP is enabled. Is there something else I have missed? // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/data.tar; $server_file = http://192.168.10.63/test/$id/data.tar;; // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=root; $ftp_user_pass=xx!; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); Thanks in advance. Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
Is there some reason that you can't use a simple samba server from the linux, to windows box? Or just do a scp copy, or just a simple ftp transfer. All of these can be done from the cmd line. It is funny, because I first started off writing this using shell_exec. I started off doing something like a sftp some_server in the commands within shell_exec() before I got to what I have now, but I stopped that because I don't seem to find any commands that can allow me put passwords and user to the actual client to do it. If there is such a thing as allowing me to feed in all this in one line without using FTP commands, this would be perfect. So far, I have not seen anything like it. I even tried doing an ftp:// on the url of the server, and it gives me this DNS error. I consider that it is easier for me to tar up everything using the command line and transfer that to another server, and then I can do the rest of the untar and other processes without problem. My problem now is that I cannot even transfer the files because I am not able to come up with the suitable commands. Is this an exercise in creating a client app/script to accomplish this? My client wants to have on the client end have all the files transferred back to the different user directories after the back end has some data processing. The client side only sees what is on the server, and not anything from the Linux from my understanding. Alice -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2008 7:50 AM To: Sam Stelfox Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors It sounds to me like your problem is now about the authentication. By default most linux distributions do not give apache a password. I personally think using apache would be a bad idea. How about creating a user on the linux box your trying to put the files on to make it's primary group apache (make sure the group can write to the folder you are putting the files in) and give it a password that is a random string of 20 characters (http://www.goodpassword.com) that only your script knows. Try testing to make sure you can ftp to the server using a normal ftp client (ftp for the linux command line or http://filezilla-project.org/ is a good one if your using windows) using the account you created. Make sure you can put files in the directory you will be with the script. If this all works and your script using the new account is not, I'm sure we can help you debug it further :). Good luck! You are right, there is something terribly wrong with my authentication. I have added one user called test and gave it a fixed password. Since the information where I intend to extract from is a Linux machine, and the location where it is meant to copy to is the Windows server. I tested it using the SSH Shell from the Windows machine to make sure it is working. It does. I have modified the script where it does the authentication to the following: // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server) or die (Failed to Connect); // login with username and password $ftp_user_name=somename; $ftp_user_pass=somepass; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die (Failed to Login); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } When I executed the script, it now prompts me back Failed to Connect as in the first die statement. I am confused because when I use the SSH with Filezilla or other SFTP clients, I used the same user and passwords here and have received no errors. I don't know if I should put the user_name and user_pass from this file to the httpd.conf, though. Currently, this is not set. Thanks in advance. Alice Wei, Alice J. wrote: Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log
Re: [PHP] Copy Function Errors
You need to test using regular FTP, SFTP goes over SSH, while the PHP script your trying to use is making use of regular old FTP. Make sure that the linux machine has the ports open for FTP and that you have an FTP server running on it (SSH is not one). Wei, Alice J. wrote: It sounds to me like your problem is now about the authentication. By default most linux distributions do not give apache a password. I personally think using apache would be a bad idea. How about creating a user on the linux box your trying to put the files on to make it's primary group apache (make sure the group can write to the folder you are putting the files in) and give it a password that is a random string of 20 characters (http://www.goodpassword.com) that only your script knows. Try testing to make sure you can ftp to the server using a normal ftp client (ftp for the linux command line or http://filezilla-project.org/ is a good one if your using windows) using the account you created. Make sure you can put files in the directory you will be with the script. If this all works and your script using the new account is not, I'm sure we can help you debug it further :). Good luck! You are right, there is something terribly wrong with my authentication. I have added one user called test and gave it a fixed password. Since the information where I intend to extract from is a Linux machine, and the location where it is meant to copy to is the Windows server. I tested it using the SSH Shell from the Windows machine to make sure it is working. It does. I have modified the script where it does the authentication to the following: // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server) or die (Failed to Connect); // login with username and password $ftp_user_name=somename; $ftp_user_pass=somepass; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die (Failed to Login); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } When I executed the script, it now prompts me back Failed to Connect as in the first die statement. I am confused because when I use the SSH with Filezilla or other SFTP clients, I used the same user and passwords here and have received no errors. I don't know if I should put the user_name and user_pass from this file to the httpd.conf, though. Currently, this is not set. Thanks in advance. Alice Wei, Alice J. wrote: Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log in of the FTP, which neither of them worked. Both of the servers have the firewall DNS set up properly, and in my PHP info page, it appears that my FTP is enabled. Is there something else I have missed? // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/data.tar; $server_file = http://192.168.10.63/test/$id/data.tar;; // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=root; $ftp_user_pass=xx!; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); Thanks in advance. Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy Function Errors
Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Anything is appreciated. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
On Wed, 2008-07-16 at 15:58 -0400, Wei, Alice J. wrote: Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
On Wed, Jul 16, 2008 at 4:45 PM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Are you considered a special student at the University? -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
On Wed, 2008-07-16 at 16:53 -0400, Daniel Brown wrote: On Wed, Jul 16, 2008 at 4:45 PM, Wei, Alice J. [EMAIL PROTECTED] wrote: Is there something I have missed here? Are you considered a special student at the University? Now, now, no need to be mean. We were all noobs at one time or another. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
On Wed, 2008-07-16 at 16:45 -0400, Wei, Alice J. wrote: Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; Shouldn't that be: $ftp_server=192.168.10.63; http:// indicates a protocol and I don't think ftp supports the protocol prefix understood by browsers. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
-Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form element. FTP's main function is the transfer of files (hence [F]ile [T]ransfer [P]rotocol), and is more in line with what you're trying to do here. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... -Original Message- From: Boyd, Todd M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 2:28 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form element. FTP's main function is the transfer of files (hence [F]ile [T]ransfer [P]rotocol), and is more in line with what you're trying to do here. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. What I am trying to accomplish is something simple, which is to copy the files from one single directory, which is already tarred, and have it be copied to a remote server. I am guessing that it is never too difficult to untar it when I get it successfully copied to another server. Right now it appears to me that it keeps on going to the second loop that says it failed, probably because my password and user do not match? I have tried switching that to apache, which is what I set in my httpd.conf for user and group. I was browsing through the articles Todd suggested, and the port number 1025 kept popping up. I am not sure if I am supposed to open this port on my remote and my local machine. I do have ssh, which is port 22 open. Thanks in advance. Alice -regards... -Original Message- From: Boyd, Todd M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 2:28 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form element. FTP's main function is the transfer of files (hence [F]ile [T]ransfer [P]rotocol), and is more in line with what you're trying to do here. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php + copy file
$carpeta = subidos; // nombre de la carpeta ya creada. chmool 777 (todos los permisos) copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE ['file']['name']); copied straight from my reply to the same question on php-db It's $_FILES not $_FILE (an 's' on the end). It's always worth using error_reporting(E_ALL) and ini_set('display_errors', true) when doing development, this would have triggered a notice or warning (can't remember which). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php + copy file
Hello I have the next code: -- archive_a_subir.php -- form action=archivo_subir.php method=post enctype=multipart/form-data input type=file name=file input type=submit value=ADJUNTAR ARCHIVO /form In archive_subir.php: ? $carpeta = subidos; // nombre de la carpeta ya creada. chmool 777 (todos los permisos) copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE ['file']['name']); ? You can see this in http://www.portbora.com.ar/foro/archivo_a_subir.php http://www.portbora.com.ar/foro/archivo_a_subir.php, when I run these appears the next warning Warning: copy(subidos/) [ http://www.portbora.com.ar/foro/function.copy http://www.portbora.com.ar/foro/function.copy function.copy]: failed to open stream: Is a directory in /home/pu000561/public_html/foro/archivo_subir.php on line 3 Why this? How can I run correctly? Thanks. + + _ // Emiliano Boragina _ // Diseño Comunicación // + + _ // [EMAIL PROTECTED] / // 15 40 58 60 02 /// + + _
[PHP] Copy Network Share W/ Diff. Creds To Local Folder?
I'm building a web app on a windows server for a company. an aspect of that requires grabbing a sound file from a network share, which i attempted with a windows copy command via exec(), but PHP needs to be able to pass the authentication credentials. runas requires password interactivity, and i've looked at runasspc but that costs for commercial use and was hoping to avoid it if possible. is there a way to finesse runas with PHP? some trick to get PHP to offer the password? or is there some other clever way to make this happen? Thank you, Jason
RE: [PHP] copy file from server to shared network folder
Thanks Rich Tom for all your help. Adding a user for apache on the remote PC's or modifying the user in httpd.conf did the trick. -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 3:48 PM To: Haig (Home) Cc: php-general@lists.php.net Subject: Re: [PHP] copy file from server to shared network folder While I don't claim to understand the Windows security model, or lack thereof, when you 2x click on something in Windows, you are you. When php does exec() php is *NOT* you. PHP is running with the permissions of the User setting in httpd.conf, whatever that means under Windows. What it means to you is that PHP User probably does NOT have permission to do what you are doing when you 2x click. Meanwhile, back at the ranch, if you are using exec() and you aren't using the optional argument to find out what error number the Operating System is giving you when it doesn't work, you're doing it wrong. :-) http://php.net/exec On Thu, April 19, 2007 11:04 pm, Haig (Home) wrote: Hi everyone, I can't seem to be able to copy a txt file from the server over to a network drive. Server is apache on winxp and the remote PC is also running XP. Remote folder is shared with all read/write rights enabled. I also tried executing a bat file where the bat file contains the copy command and that didn't work either. 2x clicking on the bat file works. I tried echo exec(c:\\test.bat); and also echo system (c:\\test.bat); and exec('c:\Windows\system32\cmd.exe /c START c:\test.bat'); and exec('c:\\Windows\\system32\\cmd.exe /c START c:\\test.bat'); with no success. The last 2 items did launch the cmd process. Any ideas? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy file from server to shared network folder
While I don't claim to understand the Windows security model, or lack thereof, when you 2x click on something in Windows, you are you. When php does exec() php is *NOT* you. PHP is running with the permissions of the User setting in httpd.conf, whatever that means under Windows. What it means to you is that PHP User probably does NOT have permission to do what you are doing when you 2x click. Meanwhile, back at the ranch, if you are using exec() and you aren't using the optional argument to find out what error number the Operating System is giving you when it doesn't work, you're doing it wrong. :-) http://php.net/exec On Thu, April 19, 2007 11:04 pm, Haig (Home) wrote: Hi everyone, I can't seem to be able to copy a txt file from the server over to a network drive. Server is apache on winxp and the remote PC is also running XP. Remote folder is shared with all read/write rights enabled. I also tried executing a bat file where the bat file contains the copy command and that didn't work either. 2x clicking on the bat file works. I tried echo exec(c:\\test.bat); and also echo system (c:\\test.bat); and exec('c:\Windows\system32\cmd.exe /c START c:\test.bat'); and exec('c:\\Windows\\system32\\cmd.exe /c START c:\\test.bat'); with no success. The last 2 items did launch the cmd process. Any ideas? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy file from server to shared network folder
Hi, Friday, April 20, 2007, 2:04:14 PM, you wrote: HH Hi everyone, HH I can't seem to be able to copy a txt file from the server over to a network HH drive. HH Server is apache on winxp and the remote PC is also running XP. HH Remote folder is shared with all read/write rights enabled. HH I also tried executing a bat file where the bat file contains the copy HH command and that didn't work either. HH 2x clicking on the bat file works. HH I tried HH echo exec(c:\\test.bat); HH and also HH echo system (c:\\test.bat); HH and HH exec('c:\Windows\system32\cmd.exe /c START c:\test.bat'); HH and HH exec('c:\\Windows\\system32\\cmd.exe /c START c:\\test.bat'); HH with no success. HH The last 2 items did launch the cmd process. HH Any ideas? Apache won't have rights to access the network, you need to read: http://httpd.apache.org/docs/1.3/win_service.html -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy, open, or manipulate an image hosted in a https server
Hello, I need to copy, open or manipulate a gif images that is hosted in a https server. But when i try to do this, i recive a warning like this: *Warning*: imagecreatefromgif(https:///aaa.gif): failed to open stream: Invalid argument in . I recive a similar message if i use: copy(https:///aaa.gif,' bla bla bla '); fopen (https:///aaa.gif, ); How can i resolve this problem and use this image? Thanks, RB
Re: [PHP] copy, open, or manipulate an image hosted in a https server
On Tue, 2006-09-12 at 12:27 -0600, R B wrote: Hello, I need to copy, open or manipulate a gif images that is hosted in a https server. But when i try to do this, i recive a warning like this: *Warning*: imagecreatefromgif(https:///aaa.gif): failed to open stream: Invalid argument in . I recive a similar message if i use: copy(https:///aaa.gif,' bla bla bla '); fopen (https:///aaa.gif, ); How can i resolve this problem and use this image? Ummm, you're missing quotes around the URL portion of the argument. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy, open, or manipulate an image hosted in a https server
It's not a syntaxis problem. On 9/12/06, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2006-09-12 at 12:27 -0600, R B wrote: Hello, I need to copy, open or manipulate a gif images that is hosted in a https server. But when i try to do this, i recive a warning like this: *Warning*: imagecreatefromgif(https:///aaa.gif): failed to open stream: Invalid argument in . I recive a similar message if i use: copy(https:///aaa.gif,' bla bla bla '); fopen (https:///aaa.gif, ); How can i resolve this problem and use this image? Ummm, you're missing quotes around the URL portion of the argument. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `'
Re: [PHP] copy, open, or manipulate an image hosted in a https server
I think it's a security https problem. I was reading that with IIS, you can't use fopen in a https server... I think i have this problem also with copy... Some ideas? On 9/12/06, R B [EMAIL PROTECTED] wrote: It's not a syntaxis problem. On 9/12/06, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2006-09-12 at 12:27 -0600, R B wrote: Hello, I need to copy, open or manipulate a gif images that is hosted in a https server. But when i try to do this, i recive a warning like this: *Warning*: imagecreatefromgif(https:///aaa.gif): failed to open stream: Invalid argument in . I recive a similar message if i use: copy(https:///aaa.gif,' bla bla bla '); fopen (https:///aaa.gif, ); How can i resolve this problem and use this image? Ummm, you're missing quotes around the URL portion of the argument. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `'
Re: [PHP] copy, open, or manipulate an image hosted in a https server
i'm just going to guess. check your settings if it allows to open external files, especifically allowed to fopen url. http://www.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen hth, john On 9/13/06, R B [EMAIL PROTECTED] wrote: I think it's a security https problem. I was reading that with IIS, you can't use fopen in a https server... I think i have this problem also with copy... Some ideas? On 9/12/06, R B [EMAIL PROTECTED] wrote: It's not a syntaxis problem. On 9/12/06, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2006-09-12 at 12:27 -0600, R B wrote: Hello, I need to copy, open or manipulate a gif images that is hosted in a https server. But when i try to do this, i recive a warning like this: *Warning*: imagecreatefromgif(https:///aaa.gif): failed to open stream: Invalid argument in . I recive a similar message if i use: copy(https:///aaa.gif,' bla bla bla '); fopen (https:///aaa.gif, ); How can i resolve this problem and use this image? Ummm, you're missing quotes around the URL portion of the argument. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- GMail Rocks!!!
[PHP] Copy of image - smaller
Hi there! When I upload a picture from a form, then I want to create a copy with a smaller image. For example: I upload a picture with dimensions 200x150 name 4.jpg. I also want a copy of this image but with the dimensions 100x75 pixels. I've tried this below, but I'm missing something I think... :-) I'm using PHP 4.x (don't know exactly the vers.nr, but I can search for it if it is of importance) The code down below is a function for uploading a picture. The part I want help with is after the comment: //What should/could I do here? Best regards Gustav Wiberg ?php function uploadPic($idUpload, $picUpload, $addUpload, $copyFile, $toPath) { //Upload chosen file to upload-map ( // if (strlen($_FILES[$picUpload]['name'])0) { //ECHO yes! ID=$idUpload PIC=$picUpload ADD=$addUploadbr; $uploaddir = dirname($_FILES[$picUpload]['tmp_name']) . /; //Replace .jpeg to .jpg // $_FILES[$picUpload]['name'] = str_replace(.jpeg,.jpg,$_FILES[$picUpload]['name']); //Get first 4 last characters of uploaded filename // $ble = strtolower(substr($_FILES[$picUpload]['name'], -4, 4)); //Move to path $toPath (followed by what to add after file (that is sent to this function)) and ext.) // $mfileAdd = $idUpload . $addUpload . $ble; move_uploaded_file($_FILES[$picUpload]['tmp_name'], $toPath . $mfileAdd); //echo mfileAdd=$mfileAddbrbr; //Set appropiate rights for file // //echo FILE TO TEST=$mfileAdd; chmod($toPath . $mfileAdd, intval('0755', 8)); //Copy this file to another file? // if (strlen($copyFile)0) { $mfile = $idUpload . $copyFile . $ble; //echo MFILE=$mfile; copy($toPath . $mfileAdd, $toPath . $mfile); chmod($toPath . $mfile, intval('0755', 8)); } //What should/could I do here? // //Set new width and height // $new_width = 100; $new_height = 200; $tmp_image=imagecreatefromjpeg($toPath . $mfileAdd); $width = imagesx($tmp_image); $height = imagesy($tmp_image); $new_image = imagecreatetruecolor($new_width,$new_height); ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width, $new_height, $width, $height); //Grab new image ob_start(); ImageJPEG($new_image); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($new_image); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); //Upload new image $copyTo = 'http://www.ledins.se/test.jpg'; $conn_id = ftp_connect('domain'); ftp_login($conn_id,'username for domain','password'); ftp_fput($conn_id, $copyTo, $fp, FTP_BINARY); fclose($fp); //Return the filename created based on productID // return $mfileAdd; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
Hi there! If I understand this right, I must have adminstration rights for installing Magic Wand... The problem is that my host doesn't have any support for this application. (It's not MY server) Is there any workaround? Best regards /Gustav Wiberg - Original Message - From: Sascha Braun [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Sent: Monday, May 15, 2006 9:18 AM Subject: Re: [PHP] Copy of image - smaller I dont have the code you need handy at the moment, but please take a look at imagemagick.org and the convert -size 120x80 in.jpg -resize 120x80 out.jpg command. First you have to use gd getimagesize command to find out the width and height of the uploaded image, to find out if the image has a higher width or height value. The scale it down by the factor needed. 200 / 120 * factor i guess. Don't forget the path in the convert command otherwise you are going to delete the original image. Normaly i do a copy(/tmp/file, /to/destination/path); unlink(/tmp(file); convert original source path to thumbnail destination path and so forth. When you get handy with ffmpeg you can do the same stuff with movies. Lame helps you to do the same with audio files. Have fun! Sascha Braun ___ SMS schreiben mit WEB.DE FreeMail - einfach, schnell und kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
Gustav Wiberg wrote: Hi there! When I upload a picture from a form, then I want to create a copy with a smaller image. For example: I upload a picture with dimensions 200x150 name 4.jpg. I also want a copy of this image but with the dimensions 100x75 pixels. I've tried this below, but I'm missing something I think... :-) I'm using PHP 4.x (don't know exactly the vers.nr, but I can search for it if it is of importance) First of all *run* to this thread and add some security checks to your image uploading: http://marc.theaimsgroup.com/?l=php-generalm=114755779206436w=2 Secondly, what does or doesn't happen with your code? It looks fine at first glance but do you get an error? What do you expect it to do and what does it actually do? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
On 5/15/06, Gustav Wiberg [EMAIL PROTECTED] wrote: [snip] //What should/could I do here? // //Set new width and height // $new_width = 100; $new_height = 200; $tmp_image=imagecreatefromjpeg($toPath . $mfileAdd); $width = imagesx($tmp_image); $height = imagesy($tmp_image); $new_image = imagecreatetruecolor($new_width,$new_height); ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width, $new_height, $width, $height); I can't see anything wrong with this resizing. //Grab new image ob_start(); ImageJPEG($new_image); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($new_image); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); Instead of doing this, you may want to use the filename argument of ImageJPEG to save the image directly to a file. //Upload new image $copyTo = 'http://www.ledins.se/test.jpg'; $conn_id = ftp_connect('domain'); ftp_login($conn_id,'username for domain','password'); ftp_fput($conn_id, $copyTo, $fp, FTP_BINARY); Destination file ($copyTo) is supposed to be a path (eg. public_html/test.jpg) and not a URL. Rabin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
- Original Message - From: Chris [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Cc: PHP General php-general@lists.php.net Sent: Monday, May 15, 2006 9:42 AM Subject: Re: [PHP] Copy of image - smaller Gustav Wiberg wrote: Hi there! When I upload a picture from a form, then I want to create a copy with a smaller image. For example: I upload a picture with dimensions 200x150 name 4.jpg. I also want a copy of this image but with the dimensions 100x75 pixels. I've tried this below, but I'm missing something I think... :-) I'm using PHP 4.x (don't know exactly the vers.nr, but I can search for it if it is of importance) First of all *run* to this thread and add some security checks to your image uploading: http://marc.theaimsgroup.com/?l=php-generalm=114755779206436w=2 Secondly, what does or doesn't happen with your code? It looks fine at first glance but do you get an error? What do you expect it to do and what does it actually do? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi there! Thanx for tip about security! There is no errors displayed, but the file test.jpg isn't created. It isn't accessible when accessing http://www.ledins.se/test.jpg Best regards /Gustav Wiberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
- Original Message - From: Rabin Vincent [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Cc: PHP General php-general@lists.php.net Sent: Monday, May 15, 2006 1:35 PM Subject: Re: [PHP] Copy of image - smaller On 5/15/06, Gustav Wiberg [EMAIL PROTECTED] wrote: [snip] //What should/could I do here? // //Set new width and height // $new_width = 100; $new_height = 200; $tmp_image=imagecreatefromjpeg($toPath . $mfileAdd); $width = imagesx($tmp_image); $height = imagesy($tmp_image); $new_image = imagecreatetruecolor($new_width,$new_height); ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width, $new_height, $width, $height); I can't see anything wrong with this resizing. //Grab new image ob_start(); ImageJPEG($new_image); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($new_image); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); Instead of doing this, you may want to use the filename argument of ImageJPEG to save the image directly to a file. //Upload new image $copyTo = 'http://www.ledins.se/test.jpg'; $conn_id = ftp_connect('domain'); ftp_login($conn_id,'username for domain','password'); ftp_fput($conn_id, $copyTo, $fp, FTP_BINARY); Destination file ($copyTo) is supposed to be a path (eg. public_html/test.jpg) and not a URL. Ok! Thanx, that might be the problem! :-) Best regards /Gustav Wiberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
I'd make a wild guess that the FTP stuff isn't working... Your biggest mistake is a total lack of error-handling... On Mon, May 15, 2006 2:03 am, Gustav Wiberg wrote: Hi there! When I upload a picture from a form, then I want to create a copy with a smaller image. For example: I upload a picture with dimensions 200x150 name 4.jpg. I also want a copy of this image but with the dimensions 100x75 pixels. I've tried this below, but I'm missing something I think... :-) I'm using PHP 4.x (don't know exactly the vers.nr, but I can search for it if it is of importance) The code down below is a function for uploading a picture. The part I want help with is after the comment: //What should/could I do here? Best regards Gustav Wiberg ?php function uploadPic($idUpload, $picUpload, $addUpload, $copyFile, $toPath) { //Upload chosen file to upload-map ( // if (strlen($_FILES[$picUpload]['name'])0) { //ECHO yes! ID=$idUpload PIC=$picUpload ADD=$addUploadbr; $uploaddir = dirname($_FILES[$picUpload]['tmp_name']) . /; //Replace .jpeg to .jpg // $_FILES[$picUpload]['name'] = str_replace(.jpeg,.jpg,$_FILES[$picUpload]['name']); //Get first 4 last characters of uploaded filename // $ble = strtolower(substr($_FILES[$picUpload]['name'], -4, 4)); //Move to path $toPath (followed by what to add after file (that is sent to this function)) and ext.) // $mfileAdd = $idUpload . $addUpload . $ble; move_uploaded_file($_FILES[$picUpload]['tmp_name'], $toPath . $mfileAdd); //echo mfileAdd=$mfileAddbrbr; //Set appropiate rights for file // //echo FILE TO TEST=$mfileAdd; chmod($toPath . $mfileAdd, intval('0755', 8)); //Copy this file to another file? // if (strlen($copyFile)0) { $mfile = $idUpload . $copyFile . $ble; //echo MFILE=$mfile; copy($toPath . $mfileAdd, $toPath . $mfile); chmod($toPath . $mfile, intval('0755', 8)); } //What should/could I do here? // //Set new width and height // $new_width = 100; $new_height = 200; $tmp_image=imagecreatefromjpeg($toPath . $mfileAdd); $width = imagesx($tmp_image); $height = imagesy($tmp_image); $new_image = imagecreatetruecolor($new_width,$new_height); ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width, $new_height, $width, $height); //Grab new image ob_start(); ImageJPEG($new_image); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($new_image); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); //Upload new image $copyTo = 'http://www.ledins.se/test.jpg'; $conn_id = ftp_connect('domain'); ftp_login($conn_id,'username for domain','password'); ftp_fput($conn_id, $copyTo, $fp, FTP_BINARY); fclose($fp); //Return the filename created based on productID // return $mfileAdd; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
For that i recomend detect the MIME, my 2 cents: function image_get_info($image) { $details = array(); $data = @getimagesize($image); if (is_array($data)){ $types = array( '1' = 'GIF', '2' = 'JPEG', '3' = 'PNG', '4' = 'SWF', '5' = 'PSD', '6' = 'BMP', '7' = 'TIFF', '8' = 'TIFF', '9' = 'JPC', '10' = 'JP2', '11' = 'JPX', '12' = 'JB2', '13' = 'SWC', '14' = 'IFF', '15' = 'WBMP', '16' = 'XBM' ); $type = array_key_exists($data[2], $types) ? $types[$data[2]] : 'Tipo de Imagen No valida o Desconocida'; $details = array('width' = $data[0], 'height'= $data[1], 'type' = $type, 'mime_type' = $data['mime'] ); } return $details; } i cutpaste :P 2006/5/15, Chris [EMAIL PROTECTED]: Gustav Wiberg wrote: Hi there! When I upload a picture from a form, then I want to create a copy with a smaller image. For example: I upload a picture with dimensions 200x150 name 4.jpg. I also want a copy of this image but with the dimensions 100x75 pixels. I've tried this below, but I'm missing something I think... :-) I'm using PHP 4.x (don't know exactly the vers.nr, but I can search for it if it is of importance) First of all *run* to this thread and add some security checks to your image uploading: http://marc.theaimsgroup.com/?l=php-generalm=114755779206436w=2 Secondly, what does or doesn't happen with your code? It looks fine at first glance but do you get an error? What do you expect it to do and what does it actually do? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- bet0x -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy of image - smaller
On Mon, May 15, 2006 7:09 pm, Alberto Ferrer wrote: For that i recomend detect the MIME, my 2 cents: function image_get_info($image) { $details = array(); $data = @getimagesize($image); if (is_array($data)){ $types = array( '1' = 'GIF', '2' = 'JPEG', '3' = 'PNG', '4' = 'SWF', '5' = 'PSD', '6' = 'BMP', '7' = 'TIFF', '8' = 'TIFF', '9' = 'JPC', '10' = 'JP2', '11' = 'JPX', '12' = 'JB2', '13' = 'SWC', '14' = 'IFF', '15' = 'WBMP', '16' = 'XBM' ); One might want to use the existing PHP constants here... IMAGETYPE_GIF for example. $type = array_key_exists($data[2], $types) ? $types[$data[2]] : 'Tipo de Imagen No valida o Desconocida'; $details = array('width' = $data[0], 'height'= $data[1], 'type' = $type, 'mime_type' = $data['mime'] ); } return $details; } i cutpaste :P 2006/5/15, Chris [EMAIL PROTECTED]: Gustav Wiberg wrote: Hi there! When I upload a picture from a form, then I want to create a copy with a smaller image. For example: I upload a picture with dimensions 200x150 name 4.jpg. I also want a copy of this image but with the dimensions 100x75 pixels. I've tried this below, but I'm missing something I think... :-) I'm using PHP 4.x (don't know exactly the vers.nr, but I can search for it if it is of importance) First of all *run* to this thread and add some security checks to your image uploading: http://marc.theaimsgroup.com/?l=php-generalm=114755779206436w=2 Secondly, what does or doesn't happen with your code? It looks fine at first glance but do you get an error? What do you expect it to do and what does it actually do? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- bet0x -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Hi all, I'm trying to copy a file from my PHP server to another server (a home gateway, called a LiveBox). I've used this code : $livebox = 192.168.1.1; ... ... ... $crontab_livebox = http://.$livebox./cgi-bin/newCrontab;; if (!copy($crontab_temp_name, $crontab_livebox)) { echo br /Impossible to copy the temp crontab file to the Livebox.br /; } I get the following error : HTTP wrapper does not support writeable connections OK can I solve this. Can't I use URLs with the copy function if they don't point to my PHP server (local URLs) ? How can I copy a file from my PHP server to another server (there's no FTP server on the destination machine) ? Put it this way: If what you typed above *DID* work, what's to stop *ME* from copying whatever I want onto your server?... I see your point. Here in my case the server I want to copy a file on has 192.168.1.1 for IP address and thus cannot be found from outside a LAN, so the security problem is not that much important. But I agree with you and see what you mean. You probably need to use cURL to login to your livebox, and then POST the data into the newCrontab form handler. OK I'm gonna look for information about that. Thank you, Laurent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Hello, on 01/27/2006 05:59 AM Laurent Vanstaen said the following: I see your point. Here in my case the server I want to copy a file on has 192.168.1.1 for IP address and thus cannot be found from outside a LAN, so the security problem is not that much important. But I agree with you and see what you mean. You may want to try sending files via form upload. Then on the destination end the you could have a PHP script that would take care of authentication and receiving and storing the uploaded files. In that case you may want to try this HTTP client class. It can act as a normal browser submitting files via POST and also authentication, cookie handling and redirection in case you want make a robust file copying system: http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Hello, on 01/27/2006 05:59 AM Laurent Vanstaen said the following: I see your point. Here in my case the server I want to copy a file on has 192.168.1.1 for IP address and thus cannot be found from outside a LAN, so the security problem is not that much important. But I agree with you and see what you mean. You may want to try sending files via form upload. Then on the destination end the you could have a PHP script that would take care of authentication and receiving and storing the uploaded files. The destination server doesn't have PHP Laurent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Hello, on 01/27/2006 11:07 AM Laurent Vanstaen said the following: I see your point. Here in my case the server I want to copy a file on has 192.168.1.1 for IP address and thus cannot be found from outside a LAN, so the security problem is not that much important. But I agree with you and see what you mean. You may want to try sending files via form upload. Then on the destination end the you could have a PHP script that would take care of authentication and receiving and storing the uploaded files. The destination server doesn't have PHP It that case you need to use a different kind of file server support. For instance, if it has Samba (Windows like file shares), you can try this other class: http://www.phpclasses.org/smbwebclient -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Laurent, Laurent Vanstaen wrote: Hello, on 01/27/2006 05:59 AM Laurent Vanstaen said the following: I see your point. Here in my case the server I want to copy a file on has 192.168.1.1 for IP address and thus cannot be found from outside a LAN, so the security problem is not that much important. But I agree with you and see what you mean. You may want to try sending files via form upload. Then on the destination end the you could have a PHP script that would take care of authentication and receiving and storing the uploaded files. The destination server doesn't have PHP When you say Livebox, are you in fact referring to the router given out by your ISP? If so, what makes you think it's writable in the first place? David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Laurent Vanstaen wrote: Hello, on 01/27/2006 05:59 AM Laurent Vanstaen said the following: I see your point. Here in my case the server I want to copy a file on has 192.168.1.1 for IP address and thus cannot be found from outside a LAN, so the security problem is not that much important. But I agree with you and see what you mean. You may want to try sending files via form upload. Then on the destination end the you could have a PHP script that would take care of authentication and receiving and storing the uploaded files. The destination server doesn't have PHP When you say Livebox, are you in fact referring to the router given out by your ISP ? Yes, that's it. If so, what makes you think it's writable in the first place? 'Cause I work for this ISP Laurent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
If so, what makes you think it's writable in the first place? 'Cause I work for this ISP So you don't have specs then I guess, since you're asking in a public forum ! Bingo :) Shitty product bought on the shelf from a third party, no specs, no doc ... Have you considered using a HTTP PUT request (using cURL)? I'm trying it. Thank you. Laurent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Laurent, Laurent Vanstaen wrote: If so, what makes you think it's writable in the first place? 'Cause I work for this ISP So you don't have specs then I guess, since you're asking in a public forum! Have you considered using a HTTP PUT request (using cURL)? php.net/curl $curl = curl_init(); $file = replacementfile.txt; curl_setopt($curl, CURLOPT_URL, 'http://192.168.1.1/cgi-bin/newCrontab'); curl_setopt($curl, CURLOPT_PUT, true); curl_setopt($curl, CURLOPT_INFILESIZE, filesize($file)); curl_setopt($curl, CURLOPT_INFILE, fopen($file, 'r')); curl_exec($curl); Note: you might need to set the CURLOPT_USERPWD option too. This is my best guess at a solution, but obviously I've not tested it. David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy problem with HTTP wrapper
Hi all, I'm trying to copy a file from my PHP server to another server (a home gateway, called a LiveBox). I've used this code : $livebox = 192.168.1.1; ... ... ... $crontab_livebox = http://.$livebox./cgi-bin/newCrontab;; if (!copy($crontab_temp_name, $crontab_livebox)) { echo br /Impossible to copy the temp crontab file to the Livebox.br /; } I get the following error : HTTP wrapper does not support writeable connections OK can I solve this. Can't I use URLs with the copy function if they don't point to my PHP server (local URLs) ? How can I copy a file from my PHP server to another server (there's no FTP server on the destination machine) ? Thanks, Laurent Vanstaen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
On Thu, January 26, 2006 9:28 am, Laurent Vanstaen wrote: Hi all, I'm trying to copy a file from my PHP server to another server (a home gateway, called a LiveBox). I've used this code : $livebox = 192.168.1.1; ... ... ... $crontab_livebox = http://.$livebox./cgi-bin/newCrontab;; if (!copy($crontab_temp_name, $crontab_livebox)) { echo br /Impossible to copy the temp crontab file to the Livebox.br /; } I get the following error : HTTP wrapper does not support writeable connections OK can I solve this. Can't I use URLs with the copy function if they don't point to my PHP server (local URLs) ? How can I copy a file from my PHP server to another server (there's no FTP server on the destination machine) ? Put it this way: If what you typed above *DID* work, what's to stop *ME* from copying whatever I want onto your server?... You probably need to use cURL to login to your livebox, and then POST the data into the newCrontab form handler. The basic idea is to use cURL to fake out the LiveBox into thinking that it's really you sitting there typing things. So you would want to have your browser open and go through the process by hand while you code your cURL script, and look at View Source in your browser for the LiveBox login, and what the cURL script gets, and then you POST the username/password to mimic a login, and then you will get back some Cookies, most likely, and then you should be able to send back those cookies and your new crontab into the form -- Essentially walking your PHP script through the exact same steps you would take to do it by hand. http://php.net/curl -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy Remote File to Local Server
I am writing a script that will read a file from a remote server and write it to the local server. It works fine except when large files are attempted. It times out and gives the error that the maximum execution time has been reached and the file will only be partially copied to the local server. Is there a way around something like this? Or perhaps could the script keep time of how long it has been running will reading/writing and then be able to continue writing to the partial file? Does anyone have any suggestions for this problem? Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Remote File to Local Server
Hello Matt, Saturday, July 16, 2005, 3:04:29 AM, you wrote: MP I am writing a script that will read a file from a remote server MP and write it to the local server. It works fine except when large MP files are attempted. It times out and gives the error that the MP maximum execution time has been reached and the file will only be MP partially copied to the local server. Is there a way around MP something like this? Or perhaps could the script keep time of how MP long it has been running will reading/writing and then be able to MP continue writing to the partial file? Does anyone have any MP suggestions for this problem? Providing you feel it's safe / user friendly to do so, just increase the time-out: set_time_limit() Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Remote File to Local Server
Wouldn't something like rsync be better suited for this? I only ask because I've run something like this before... Matt Darby Richard Davey wrote: Hello Matt, Saturday, July 16, 2005, 3:04:29 AM, you wrote: MP I am writing a script that will read a file from a remote server MP and write it to the local server. It works fine except when large MP files are attempted. It times out and gives the error that the MP maximum execution time has been reached and the file will only be MP partially copied to the local server. Is there a way around MP something like this? Or perhaps could the script keep time of how MP long it has been running will reading/writing and then be able to MP continue writing to the partial file? Does anyone have any MP suggestions for this problem? Providing you feel it's safe / user friendly to do so, just increase the time-out: set_time_limit() Best regards, Richard Davey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Copy Remote File to Local Server
Hello Matt, Saturday, July 16, 2005, 3:31:26 AM, you wrote: MP I don't have access to edit the php.ini settings. Is there anyway to MP copy part of the file, then copy the rest where it left off? [ Note: Please reply to the mailing list - not to me personally ] The suggestion I gave you doesn't involve the php.ini file at all - try looking in the PHP manual for the function given. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy to network share
I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
On Wednesday 01 June 2005 14:42, Jeff McKeon wrote: $dirhandle = opendir(server\\share); Readdir($dirhandle); Chdir(server//share); Chdir(server\\share); Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? You should put the dirname in quotes Like $dirhandle=opendir(Server\\Share); Regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
sorry I ment to send to email to the list I tried the code bellow on my windows machine. I have a mapped network drive on my windows machine (i: drive) that links to a samba share (my htdocs directory on my linux dev machine). It worked fine. echo getcwd(); chdir('i:'); echo br; echo getcwd(); clive Jeff McKeon wrote: Yes, doesn't work either Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:19 PM To: Jeff McKeon Subject: Re: [PHP] Copy to network share Hi jave you tried creating a mapped network drive on windows? clive Jeff McKeon wrote: I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
All, The syntax is correct... It's not a quotes problem. I have the path in quotes in my actual code. Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: Andy Pieters [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 9:34 AM To: php-general@lists.php.net Subject: Re: [PHP] Copy to network share On Wednesday 01 June 2005 14:42, Jeff McKeon wrote: $dirhandle = opendir(server\\share); Readdir($dirhandle); Chdir(server//share); Chdir(server\\share); Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? You should put the dirname in quotes Like $dirhandle=opendir(Server\\Share); Regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
Is that drive mapped on your local machine or on the web server? Jeff -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:31 PM To: Jeff McKeon; php Subject: Re: [PHP] Copy to network share sorry I ment to send to email to the list I tried the code bellow on my windows machine. I have a mapped network drive on my windows machine (i: drive) that links to a samba share (my htdocs directory on my linux dev machine). It worked fine. echo getcwd(); chdir('i:'); echo br; echo getcwd(); clive Jeff McKeon wrote: Yes, doesn't work either Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:19 PM To: Jeff McKeon Subject: Re: [PHP] Copy to network share Hi jave you tried creating a mapped network drive on windows? clive Jeff McKeon wrote: I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
its on my local machine, in your case it will your w2k box. clive Jeff McKeon wrote: Is that drive mapped on your local machine or on the web server? Jeff -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:31 PM To: Jeff McKeon; php Subject: Re: [PHP] Copy to network share sorry I ment to send to email to the list I tried the code bellow on my windows machine. I have a mapped network drive on my windows machine (i: drive) that links to a samba share (my htdocs directory on my linux dev machine). It worked fine. echo getcwd(); chdir('i:'); echo br; echo getcwd(); clive Jeff McKeon wrote: Yes, doesn't work either Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:19 PM To: Jeff McKeon Subject: Re: [PHP] Copy to network share Hi jave you tried creating a mapped network drive on windows? clive Jeff McKeon wrote: I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
That won't work. I don't want the users mapping a drive on their local machine. I tried mapping it on the server running the IIS and doing as you suggest, but it doesn't work. Jeff -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 10:04 PM To: php Subject: Re: [PHP] Copy to network share its on my local machine, in your case it will your w2k box. clive Jeff McKeon wrote: Is that drive mapped on your local machine or on the web server? Jeff -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:31 PM To: Jeff McKeon; php Subject: Re: [PHP] Copy to network share sorry I ment to send to email to the list I tried the code bellow on my windows machine. I have a mapped network drive on my windows machine (i: drive) that links to a samba share (my htdocs directory on my linux dev machine). It worked fine. echo getcwd(); chdir('i:'); echo br; echo getcwd(); clive Jeff McKeon wrote: Yes, doesn't work either Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:19 PM To: Jeff McKeon Subject: Re: [PHP] Copy to network share Hi jave you tried creating a mapped network drive on windows? clive Jeff McKeon wrote: I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
Jeff McKeon wrote: That won't work. I don't want the users mapping a drive on their local machine. I tried mapping it on the server running the IIS and doing as you suggest, but it doesn't work. Jeff Have you made sure that the IUSR account that IIS is running has has got the right permissions to access the drive that you have mapped? HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
I never managed to get this working with IIS. I could with Apache (win) though, after making sure that Apache was logged in as the administrator. George -Original Message- From: Mikey [mailto:[EMAIL PROTECTED] Sent: 1 June 2005 7:54 pm To: php Subject: Re: [PHP] Copy to network share Jeff McKeon wrote: That won't work. I don't want the users mapping a drive on their local machine. I tried mapping it on the server running the IIS and doing as you suggest, but it doesn't work. Jeff Have you made sure that the IUSR account that IIS is running has has got the right permissions to access the drive that you have mapped? HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
George Pitcher wrote: I never managed to get this working with IIS. I could with Apache (win) though, after making sure that Apache was logged in as the administrator. George Thus proving that this is a permissions issue, not a PHP issue! Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy sent mail in a mailbox folder
On Sat, May 28, 2005 2:58 am, Reto said: Hi list, I'm sending mails with PEAR::Mail / PEAR::Mail_Mime or with PHPMailer (http://phpmailer.sf.net). The final solution will implemented depending on which implementation better fits my needs. Anyway, and that is the problem, after sending the mail I want to save a copy of the mail in an IMAP folder called Sent. I would be pleased if someone could send me a hint or a link how to achive this. Either with PEAR or with PHPMailer generated mails. My first thought was to walk through the mail object and extracting all necessary attributes and generating a new message and save this to the mailfolder... If all else fails, you could send it to your From: address with an extra header like: X-File-In-Sent: File-In-Sent-Folder and then put a filter in your email client to filter all the stuff on that header into Sent Crude, but effective :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy sent mail in a mailbox folder
Hi list, I'm sending mails with PEAR::Mail / PEAR::Mail_Mime or with PHPMailer (http://phpmailer.sf.net). The final solution will implemented depending on which implementation better fits my needs. Anyway, and that is the problem, after sending the mail I want to save a copy of the mail in an IMAP folder called Sent. I would be pleased if someone could send me a hint or a link how to achive this. Either with PEAR or with PHPMailer generated mails. My first thought was to walk through the mail object and extracting all necessary attributes and generating a new message and save this to the mailfolder... Thanks in advance reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy sent mail in a mailbox folder PS
Hi again, Anyway, and that is the problem, after sending the mail I want to save a copy of the mail in an IMAP folder called Sent. Just found the imap_append() which will solve the problem. If someone has experience with mail_append() in conjunction with PEAR Mail_Mime I would be please if sharing with me... cu reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: SV: SV: [PHP] Copy? - What am I doing wrong???
Wiberg wrote: Hi there! fgtcvs works fine, but there's another problem now... I run updates to the db for each row (every row is unique) and must be updated. If I run the script with 2 rows then my site couldn't open the database from another location. Is this MySQL-specific or PHP-specific? Is there any way to release memoryresources in PHP? I am not going to answer this question for 2 reasons: 1. I'm not your personal helpdesk. (mail the list not me personally - use 'Reply All') 2. I don't get what your asking. with regard to memory: unset() with regard to the rest, please post your question again, this time to the list, also try to formulate your question differently (if I don't understand it probably other people won't either - and that increases the chance that your mail will be ignored) rgds, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: SV: SV: [PHP] Copy? - What am I doing wrong???
Jochem Maas wrote: Wiberg wrote: Hi there! fgtcvs works fine, but there's another problem now... I run updates to the db for each row (every row is unique) and must be updated. If I run the script with 2 rows then my site couldn't open the database from another location. Is this MySQL-specific or PHP-specific? Is there any way to release memoryresources in PHP? I am not going to answer this question for 2 reasons: 1. I'm not your personal helpdesk. (mail the list not me personally - use 'Reply All') 2. I don't get what your asking. with regard to memory: unset() with regard to the rest, please post your question again, this time to the list, also try to formulate your question differently (if I don't understand it probably other people won't either - and that increases the chance that your mail will be ignored) I'm guessing he's running into a table-locking problem while trying to update 2 records with unique IDs. If so, solutions include: Doing the updates a few rows at a time, so the table is only locked for a few seconds every minute over the course of a day. Altering the underlying table type in MySQL from MyISAM to, err, some table format that supports row-locking??? [I could be way off base and ISAM already does that...] It's also entirely possible he's only anticipating a problem that isn't a problem. Hard to tell. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: SV: SV: SV: [PHP] Copy? - What am I doing wrong???
Hi there! You're right. It wasn't a problem. It was my local Win-computer that failed totally... /G @varupiraten.se -Ursprungligt meddelande- Från: Richard Lynch [mailto:[EMAIL PROTECTED] Skickat: den 25 februari 2005 21:46 Till: Jochem Maas Kopia: [EMAIL PROTECTED]; [php] PHP General List Ämne: Re: SV: SV: SV: [PHP] Copy? - What am I doing wrong??? Jochem Maas wrote: Wiberg wrote: Hi there! fgtcvs works fine, but there's another problem now... I run updates to the db for each row (every row is unique) and must be updated. If I run the script with 2 rows then my site couldn't open the database from another location. Is this MySQL-specific or PHP-specific? Is there any way to release memoryresources in PHP? I am not going to answer this question for 2 reasons: 1. I'm not your personal helpdesk. (mail the list not me personally - use 'Reply All') 2. I don't get what your asking. with regard to memory: unset() with regard to the rest, please post your question again, this time to the list, also try to formulate your question differently (if I don't understand it probably other people won't either - and that increases the chance that your mail will be ignored) I'm guessing he's running into a table-locking problem while trying to update 2 records with unique IDs. If so, solutions include: Doing the updates a few rows at a time, so the table is only locked for a few seconds every minute over the course of a day. Altering the underlying table type in MySQL from MyISAM to, err, some table format that supports row-locking??? [I could be way off base and ISAM already does that...] It's also entirely possible he's only anticipating a problem that isn't a problem. Hard to tell. -- Like Music? http://l-i-e.com/artists.htm -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2005-02-22 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2005-02-22 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy?
Hi there! How do I copy a file from an URL to my server? I url fopen wrappers is NOT enabled, and I'm not allowed to do that. /G @varupiraten.se -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 2005-02-10 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy?
Wiberg wrote: Hi there! How do I copy a file from an URL to my server? I url fopen wrappers is NOT enabled, and I'm not allowed to do that. do you have access to the cURL extension in your php build? www.php.net/curl if you do then you should be able to use to do what you want, might take a bit of reading to figure out all the options you need to set to correctly send a request and retrieve the desired response (i.e. have a file returned) another resort might be to use exec() or a similar function to call wget (I'm assuming your on *nix).. and then use fopen to read the file that wget downloaded - obviously you need to have access to wget via php and take into account any possible filepermission pitfalls. /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy?
Wiberg wrote: Hi there! How do I copy a file from an URL to my server? I url fopen wrappers is NOT enabled, and I'm not allowed to do that. http://www.php.net/curl or use wget via system, exec, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy mySQL database...
I just need to make a duplicate copy of a mySQL database (I have to reinstall some web software and I am afraid it will overwrite the existing database, so i would like to make a backup of it)... Any classes, scripts, etc out there to do this? Russ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy mySQL database...
I just need to make a duplicate copy of a mySQL database (I have to reinstall some web software and I am afraid it will overwrite the existing database, so i would like to make a backup of it)... Any classes, scripts, etc out there to do this? Russ Try RTFM for mySQL, section 5.6.1 in my local copy. Don't use a sledgehammer to open a walnut :-) Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy mySQL database...
Russell P Jones wrote: I just need to make a duplicate copy of a mySQL database (I have to reinstall some web software and I am afraid it will overwrite the existing database, so i would like to make a backup of it)... Any classes, scripts, etc out there to do this? oh for gods sake, do you not think that the guys at mysql have thought that backups might be a good thing?: http://dev.mysql.com/doc/mysql/en/mysqldump.html or try phpmyadmin Russ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy mySQL database...
At 08:52 AM 2/3/2005, you wrote: I just need to make a duplicate copy of a mySQL database (I have to reinstall some web software and I am afraid it will overwrite the existing database, so i would like to make a backup of it)... Any classes, scripts, etc out there to do this? This is more of a question for the mysql mailing list unless you MUST use PHP to do it. In that case, I would suggest phpmyadminjust my preference. Besides mysqldump and a few other things. You can also just copy the directory to a new directory if you have root access. Just make sure that you keep the same permissions. cd /var/lib/mysql (assuming this is where your databases are) mkdir backuptest (this would be the name of the new directory) cp -pr test/* backuptest (this would copy the database test to the new directory you just created) It would be a good idea to stop the database first then do a myisamchk. myisamchk --silent --force --fast --update-state -O key_buffer=64M \ -O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M \ /var/lib/mysql/*/*.MYI Those \ backslash characters are to tell you that the command is all one line (without the backslashes). After you have done all of this, then restart the database. If you are moving to a new machine with the data, then you can either use the mysqldump of the database or tar/gzip up the directory before you restart mysqld and untar/ungzip it onto the new machine. I am not going to guarantee that the last method will always work for you, but I have done it in the past from linux to linux, linux to windows and windows to linux with no problem. If you are moving it to a new server, you will need to make sure to setup the access permissions again in the mysql database. Also, you can use the backuptest database by doing the same thing if you are not root and root doesn't have full privileges on every database. Strange, but I have seen a setup like that. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy() not working
Solution to the problem: instead of trying to write it to /image/filename I write it to ../image/filename, that solves my problem :) /Peter Peter Lauri [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Thank you. Now I am getting somewhere, but I get this error-msg now, I do not understand the content of it. Have tried to read about the Auth in PHP but I did not get any information to solve the problem: Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 113323 is not allowed to access / owned by uid 0 in /customers/devdws.com/devdws.com/httpd.www/admin/imageadmin.php on line 36 Possible file upload attack! Here is some more debugging info:Array ( [userfile] = Array ( [name] = but_hide.gif [type] = image/gif [tmp_name] = /tmp/phpugQpuz [error] = 0 [size] = 1054 ) ) - BEST OF TIMES /Peter Burhan Khalid [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED]... On Tue, 2004-11-16 at 14:58 +0100, Peter Lauri wrote: Best groupmember, I am implementing a script to upload a file to my webserver. I am using this form that I copied from a working application: [ snipped ] To handle the form I am using this script... if($File) { if(copy($File, $File_name)) { echo 'The image was not uploaded!'; } else { echo 'The file was not uploaded!'; } } It does not even enter the if($File) part (checked it witch echos). Use move_uploaded_file() -- and read http://www.php.net/manual/en/features.file-upload.php -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy() not working
Best groupmember, I am implementing a script to upload a file to my webserver. I am using this form that I copied from a working application: echo 'form action=imageadmin.php method=POST enctype=multipart/form-data'; echo 'input type=file name=Filebrinput type=submit name=submit value=Upload image'; echo '/form'; To handle the form I am using this script... if($File) { if(copy($File, $File_name)) { echo 'The image was not uploaded!'; } else { echo 'The file was not uploaded!'; } } It does not even enter the if($File) part (checked it witch echos). The php-info() can be seen at www.devdws.com/phpinfo.php Is there anyone that see any errors in the problem? I have checked severeal manuals and this is how it should be. - The Best Of Times Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy() not working
Hello Peter, Tuesday, November 16, 2004, 1:58:48 PM, you wrote: PL if($File) { PL if(copy($File, $File_name)) { PLecho 'The image was not uploaded!'; PL } else { PLecho 'The file was not uploaded!'; PL } PL } PL It does not even enter the if($File) part (checked it witch echos). Do you have Register Globals turned on or off? If they are off (as they should be), this script will not work. You should really use move_uploaded_file() to move the file rather than copy. And check the $_FILES array for your file name, size, etc. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy() not working
On Tue, 2004-11-16 at 14:58 +0100, Peter Lauri wrote: Best groupmember, I am implementing a script to upload a file to my webserver. I am using this form that I copied from a working application: [ snipped ] To handle the form I am using this script... if($File) { if(copy($File, $File_name)) { echo 'The image was not uploaded!'; } else { echo 'The file was not uploaded!'; } } It does not even enter the if($File) part (checked it witch echos). Use move_uploaded_file() -- and read http://www.php.net/manual/en/features.file-upload.php -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy() not working
On Tuesday 16 November 2004 21:58, Peter Lauri wrote: Is there anyone that see any errors in the problem? I have checked severeal manuals and this is how it should be. Funny, the example(s) in the manual look quite different. Try the ones in the manual, when you get them working then modify to taste. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Advancement in position. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy function?
I have a button which I want to add a function to, so that when it is clicked, the data from one textarea will be copied to another textarea Which event handler of the button should I use and hoe should I construct the function? Garth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy function?
On Tue, 16 Nov 2004 16:42:31 +0200, Garth Hapgood - Strickland [EMAIL PROTECTED] wrote: I have a button which I want to add a function to, so that when it is clicked, the data from one textarea will be copied to another textarea Which event handler of the button should I use and hoe should I construct the function? That's Javascript, not PHP. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] copy function?
[snip] I have a button which I want to add a function to, so that when it is clicked, the data from one textarea will be copied to another textarea Which event handler of the button should I use and hoe should I construct the function? [/snip] Both textareas on the same page? Want to do the copy without making a trip to the server? I think you want JavaScript for this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy function?
I have a button which I want to add a function to, so that when it is clicked, the data from one textarea will be copied to another textarea Which event handler of the button should I use and hoe should I construct the function? onclick. This is not really a php question. do some googleing for javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy function?
On Tue, 2004-11-16 at 16:42 +0200, Garth Hapgood - Strickland wrote: I have a button which I want to add a function to, so that when it is clicked, the data from one textarea will be copied to another textarea Which event handler of the button should I use and hoe should I construct the function? Garth Php doesn't do anything like this...unless you post a form. Try javascript. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP] copy function?
Hello Garth, Tuesday, November 16, 2004, 2:42:31 PM, you wrote: GHS Which event handler of the button should I use and hoe should I construct GHS the function? This is a JavaScript question. Please post to a JavaScript mailing list. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy() not working
Thank you. Now I am getting somewhere, but I get this error-msg now, I do not understand the content of it. Have tried to read about the Auth in PHP but I did not get any information to solve the problem: Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 113323 is not allowed to access / owned by uid 0 in /customers/devdws.com/devdws.com/httpd.www/admin/imageadmin.php on line 36 Possible file upload attack! Here is some more debugging info:Array ( [userfile] = Array ( [name] = but_hide.gif [type] = image/gif [tmp_name] = /tmp/phpugQpuz [error] = 0 [size] = 1054 ) ) - BEST OF TIMES /Peter Burhan Khalid [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED]... On Tue, 2004-11-16 at 14:58 +0100, Peter Lauri wrote: Best groupmember, I am implementing a script to upload a file to my webserver. I am using this form that I copied from a working application: [ snipped ] To handle the form I am using this script... if($File) { if(copy($File, $File_name)) { echo 'The image was not uploaded!'; } else { echo 'The file was not uploaded!'; } } It does not even enter the if($File) part (checked it witch echos). Use move_uploaded_file() -- and read http://www.php.net/manual/en/features.file-upload.php -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] COPY with PostgreSQL
I am using COPY for PostgreSQL and having problems now that the incoming file contains more than approx 1500 lines. Is this an issue anyone is aware of? Lot's of files over 1000 lines have worked fine, but after getting a file over 1800 I began having problems. I have broke the file down to a approx. 1500 line that works sometimes and not others. Here is a snippet of what I'm trying to do: $result = pg_exec($dbh, COPY tblxrf FROM stdin USING DELIMITERS ','); fseek($temp_fh,0); // go to beginning of temp file while (($csv_line = fgets($temp_fh,1024))) { pg_put_line($dbh, $csv_line); } $stat = pg_put_line($dbh, \\.\n); // notify db finished or report error if (!$stat) { echo ERROR: An error has occurred while putting last line of copy databr\n; exit; } $stat = pg_end_copy($dbh); // post (sync data) or report error The process just hangs with the large number of lines, I have to kill the COPY process for postgresql on the server before trying again. -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] COPY with PostgreSQL
[snip] I am using COPY for PostgreSQL and having problems... [/snip] So, is this a PHP problem, or a PostgreSQL problem? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] COPY with PostgreSQL
Jay Blanchard wrote: [snip] I am using COPY for PostgreSQL and having problems... [/snip] So, is this a PHP problem, or a PostgreSQL problem? Why does it matter??? Just answer the ding-dang question. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] COPY with PostgreSQL
[snip] Why does it matter??? Just answer the ding-dang question. ;) [/snip] Easy there Kemosabe', someone might mistake you for someone who wants to help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] COPY with PostgreSQL
Jay Blanchard wrote: [snip] Why does it matter??? Just answer the ding-dang question. ;) [/snip] Easy there Kemosabe', someone might mistake you for someone who wants to help! *goes back to lurking* -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] COPY with PostgreSQL
On Fri, 22 Oct 2004 14:34:39 -0400, Robert Fitzpatrick [EMAIL PROTECTED] wrote: I am using COPY for PostgreSQL and having problems now that the incoming file contains more than approx 1500 lines. Is this an issue anyone is aware of? Lot's of files over 1000 lines have worked fine, but after getting a file over 1800 I began having problems. I have broke the file down to a approx. 1500 line that works sometimes and not others. Here is a snippet of what I'm trying to do: $result = pg_exec($dbh, COPY tblxrf FROM stdin USING DELIMITERS ','); You might try COPY BINARY here in case you have some stray non-escaped characters. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] COPY with PostgreSQL
On Fri, 2004-10-22 at 14:55, Jay Blanchard wrote: [snip] I am using COPY for PostgreSQL and having problems... [/snip] So, is this a PHP problem, or a PostgreSQL problem? If I took the file it is trying to COPY into PostgreSQL and psql to bring it in on the server directly, no issues. Seems to be a PHP problem, at least with the pg libraries. I finally, after trying many things have gotten this to work with the large files. I found, if I issue a pg_connection_busy($dbh) before the pg_put_line(...) in the while statement processing the lines of the temp file handle, it works. Don't ask me why, that is what I'd like to know. If I report back if busy is true, I get nothing. Maybe it is just giving a millisecond to breathe or something while checking to see if the connection is busy. But with that one line, all is well. -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Max Filesize for PHP copy
I posted this in the Netware PHP newsgroup, but have not gotten a response. Hopefully I will get something here. I was using a script to copy a file from one location to another. It was working great (but was only testing with small files under 1MB) and then when I tried uploading a file that was a little over 4MB the server abended with the message Cache memory allocator out of available memory. I looked in the PHP.ini file and changed the max filesize to 5MB and tried to copy the same file. It worked, but I received the same message, but it didn't abend. I don't think that this is normal and would appreciate any suggestions as to a better method or an explanation as to what may be causing this. Netware 6, PHP 4.2.4 (newest version for Netware), Apache 2.0.48 Thanks in advance, Ashley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy function
Is there a way to copy a file from 1 server to a different one? I have this code in a win 2k server, and i try to copy the file to a win NT server: if (is_file($file_att)) if (copy($file_att,'\servername\folder\'.$file_name)) echo succesful; else echo failure; It gives me this warning: Warning: Unable to create '\servername\folder\image.jpg': Invalid argument in D:\Intranet\sitio\Documentos\copyf.php on line 161 failure I need this to work on any computer of the network. What kind of permission do I need so any computer can use this script? Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php