Re[2]: [PHP] wget --spider and ignore_user_abort(TRUE)
Greetings, Martino Dell'Ambrogio. In reply to Your message dated Tuesday, November 4, 2008, 15:11:45, - if I use wget --spider (HEAD request) the script exits just after the first output, all the functions below never get executed It is intended behaviour. Apache sending headers at the moment first body byte sent, and since it is HEAD request, Apache shut down the script in case of request completion (HEADers sent). -- Sincerely Yours, ANR Daemon [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] wget --spider and ignore_user_abort(TRUE)
Hi there, I am trying to get a script to run in background no matter what, but I am obviously doing it wrong. Here is the entire code: ?php //first instruction to be sure it is parsed ignore_user_abort(TRUE); set_time_limit(3600); //sleep(10); //this will send the HTTP code + headers + test ob_start(); echo test; ob_flush(); sleep(10); system(touch /tmp/aborting); ? The file /tmp/aborting get touched if I abort the connection in a browser, or if I run wget blabla/script.php and kill wget... in fact it works perfectly in any way, but it doesn't work when I use the --spider option of wget. That option does a HEAD request and as soon as it receives the HTTP code 200 closes the connection. The script is then aborted and the file /tmp/aborting never get touched. I initially thought that ignore_user_abort() never get to be parsed because the connection is closed before and I set it in the php.ini file, but that didn't work. I then realized that PHP has to get at least to the ob_flush() call, that's proved by putting a sleep(10) just before the ob_start() call: wget --spider waits 10 seconds before exiting. Why is ignore_user_abort(TRUE) ignored, what am I missing? I probably shouldn't say that while asking for help, but... is this a bug? I am using PHP 5.2.6-pl7-gentoo via Apache 2.2.9-r1 (Gentoo) with worker MPM. Thank you for your help, tillo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
I need the PHP script to keep running until the end) Until the end of what? Time? If you want your HTTP request to finish and a script to continue regardless then use the method I suggested, an start a shell process going. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
- if I use wget --spider (HEAD request) the script exits just after the first output, all the functions below never get executed This has nothing to do with any system command. Then have your HTTP request trigger a system command that runs on regardless. The HTTP request continues on after triggering the system command, not giving a tiny rats ass what it does. You can use the exec() code I gave you to do this (ie using an ampersand and redirecting the output streams). -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 13:24:41 +0100, Jochem Maas wrote: try testing for the request type (i.e. HEAD) and if found don't output anything at all. This is a nice workaround and works perfectly, thanks! seems like apache (not the user) is shutting down the request as soon as it recieves the first byte of the request body. I thought so, I just hoped there was some way to make PHP (or Apache) continue the work in any case. The no-output way works for me, thank you. tillo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 11:59:20 +, Richard Heyes wrote: I need the PHP script to keep running until the end) Until the end of what? Time? Until the end of the script. If you want your HTTP request to finish and a script to continue regardless then use the method I suggested, an start a shell process going. I insist :) sorry. You didn't understand what I am doing, probably because of my ESL... - I have a PHP script - this PHP script has X sequential functions - every function must be executed - if I open the page (GET request), all is fine - if I open the page then stop the client connection while the script is still running, all is fine (client sends an RST, ignore_user_abort kicks in, script goes through all of its X functions then exits at the end of the script) - if I use wget --spider (HEAD request) the script exits just after the first output, all the functions below never get executed This has nothing to do with any system command. Is it clear now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 10:03:11 +, Richard Heyes wrote: I am trying to get a script to run in background no matter what, but I am obviously doing it wrong. 1. Have it executed via a shell command. 2. Redirect all output. 3. Append the ampersand. This is not what I need, but thanks. The code snippet I wrote is just an example of the PHP connection handling going wrong (or not as I want to). The real script doesn't sleep and does much more then executing a system command. The question here is: why a PHP script called via 'wget --spider' through Apache/2 gets killed as soon as the HTTP reply code is sent, even if ignore_user_abort() is set? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
The question here is: why a PHP script called via 'wget --spider' through Apache/2 gets killed as soon as the HTTP reply code is sent, even if ignore_user_abort() is set? A script ending naturally is not the same as a user aborting. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
I am trying to get a script to run in background no matter what, but I am obviously doing it wrong. 1. Have it executed via a shell command. 2. Redirect all output. 3. Append the ampersand. eg. A commandx such as: sleep 5 /dev/null 21 would become: ?php exec('sleep 5 /dev/null 21 '); ? -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 11:37:15 +, Richard Heyes wrote: The question here is: why a PHP script called via 'wget --spider' through Apache/2 gets killed as soon as the HTTP reply code is sent, even if ignore_user_abort() is set? A script ending naturally is not the same as a user aborting. I agree, but why is the script ending? Does PHP is set to stop running as soon as it knows the size of the reply, required by an HEAD request? How can I override this? (by script I mean the PHP script. Your previous post forks PHP and runs a system command without exiting it when the script exits (nohup should be used instead of the output redirection), I understood that but it is not what I need; I need the PHP script to keep running until the end) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
Martino Dell'Ambrogio schreef: On Tue, 04 Nov 2008 11:59:20 +, Richard Heyes wrote: I need the PHP script to keep running until the end) Until the end of what? Time? Until the end of the script. If you want your HTTP request to finish and a script to continue regardless then use the method I suggested, an start a shell process going. I insist :) sorry. You didn't understand what I am doing, probably because of my ESL... - I have a PHP script - this PHP script has X sequential functions - every function must be executed - if I open the page (GET request), all is fine - if I open the page then stop the client connection while the script is still running, all is fine (client sends an RST, ignore_user_abort kicks in, script goes through all of its X functions then exits at the end of the script) - if I use wget --spider (HEAD request) the script exits just after the first output, all the functions below never get executed try testing for the request type (i.e. HEAD) and if found don't output anything at all. seems like apache (not the user) is shutting down the request as soon as it recieves the first byte of the request body. This has nothing to do with any system command. Is it clear now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php wget: Return an empty file
Greetings PHP(eople), I have a wget process that runs to download a file from a web site, however, if no file exists at the location I`m pulsing, how do I get it to abort ? Here is the code : ?php $getfile = 'wget -dv -o log.txt http://www.somesite.co.za/somefile.php'; $get = shell_exec($getfile); ? I looked at filesize(), but if no file is brought back then there is nothing for the function to check. If someone could point me to the right PHP function, or a link somewhere... Regards -- Chris Blake Cell: 082 775 1492 Work: +27 11 782 0840 Fax : +27 11 782 0841 Mail: [EMAIL PROTECTED] I have a very good DENTAL PLAN. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php wget: Return an empty file [Solved]
On Fri, 2005-04-08 at 09:47, Chris Blake wrote: Greetings PHP(eople), I have a wget process that runs to download a file from a web site, however, if no file exists at the location I`m pulsing, how do I get it to abort ? Here is the code : ?php $getfile = 'wget -dv -o log.txt http://www.somesite.co.za/somefile.php'; $get = shell_exec($getfile); ? I looked at filesize(), but if no file is brought back then there is nothing for the function to check. If someone could point me to the right PHP function, or a link somewhere... No worries, file_exists() was what I was looking for. Regards -- Chris Blake Cell: 082 775 1492 Work: +27 11 782 0840 Fax : +27 11 782 0841 Mail: [EMAIL PROTECTED] When managers hold endless meetings, the programmers write games. When accountants talk of quarterly profits, the development budget is about to be cut. When senior scientists talk blue sky, the clouds are about to roll in. Truly, this is not the Tao of Programming. When managers make commitments, game programs are ignored. When accountants make long-range plans, harmony and order are about to be restored. When senior scientists address the problems at hand, the problems will soon be solved. Truly, this is the Tao of Programming. -- Geoffrey James, The Tao of Programming -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php wget: Return an empty file
Chris Blake wrote: Greetings PHP(eople), I have a wget process that runs to download a file from a web site, Why would you do that ? There're bultin functions in PHP for doing it. -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php wget: Return an empty file
On Fri, 2005-04-08 at 13:52, Josip Dzolonga wrote: Chris Blake wrote: Greetings PHP(eople), I have a wget process that runs to download a file from a web site, Why would you do that ? There're bultin functions in PHP for doing it. wget was the first thing I thought of :) -- Chris Blake Cell: 082 775 1492 Work: +27 11 782 0840 Fax : +27 11 782 0841 Mail: [EMAIL PROTECTED] A woman was in love with fourteen soldiers. It was clearly platoonic. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php wget: Return an empty file
Chris Blake wrote: wget was the first thing I thought of :) You thought wrong :-) Are you are going to parse the file after you've downloaded it ? See this function, http://www.php.net/file_get_contents , if allow_url_fopen is set to TRUE in your php.ini, there will be no problems opening a URL, so $contents = file_get_contents($url); is going to to the job perfectly ! Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] wget
Hi. I'm using wget -q -o /home/httpd/html/temp/logs.txt http://localhost/script.php; to run a php script from shell. But 'wget' always create a log file with same name of the script that wget are running in /home/httpd/html/. why he doesn't put the logs in logs.txt? thanks. Augusto ___ Yahoo! GeoCities Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. É fácil e grátis! http://br.geocities.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Wget and PHP
Do you mean to suck down the pre-interpreted scripts from a remote server? Can't be done. The server interprets the scripts long before they ever get put on the network. Your best bet will be to e-mail the admin and ask = Ben -Original Message- From: Clayton Dukes [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 15, 2001 9:59 AM To: [EMAIL PROTECTED] Subject: [PHP] Wget and PHP Is there a utility available that will get PHP based websites? Wget doesn't do it TIA! Clayton Dukes CCNA, CCDA, CCDP, CCNP Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net
[PHP] Wget and PHP
Is there a utility available that will get PHP based websites? Wget doesn't do it TIA! Clayton DukesCCNA, CCDA, CCDP, CCNPDownload Free Essays, Term Papers and Cisco Training from http://www.gdd.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Wget and PHP
Wget works just fine for me here. The one problem I see is if you need to complete a form for entry, session login, then it can be a problem. I solve that by allowing a no login on our development box behind the firewall. I'm sure it could be done use a post (php has a post class I believe) since wget can read url inputs from a file. What doesn't work on your end? DAve on 7/15/01 9:59 AM, Clayton Dukes at [EMAIL PROTECTED] wrote: Is there a utility available that will get PHP based websites? Wget doesn't do it TIA! Clayton Dukes CCNA, CCDA, CCDP, CCNP Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net http://www.gdd.net -- Dave Goodrich Director of Interface Development Reality Based Learning Company 9521 NE Willows Road, Suite 100 Redmond, WA 98052 Toll Free 1-877-869-6603 ext. 237 Fax (425) 558-5655 [EMAIL PROTECTED] http://www.rblc.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Wget and PHP
on 7/15/01 9:59 AM, Clayton Dukes at [EMAIL PROTECTED] wrote: Is there a utility available that will get PHP based websites? Wget doesn't do it TIA! Clayton Dukes CCNA, CCDA, CCDP, CCNP Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net http://www.gdd.net wget -A=html,php,php3 # list of accepted extensions -r # recursive web-suck -- use with care! -l 3 # maximum recursion depth (0 to unlimit). -k # convert non-relative links to relative -nv # turn off verboseness, without being quiet sysadmin@zeus:/usr/local/home/sysadmin$ wget -A=html,php,php3 -r -l 3 -k -nv www.php.net 10:22:33 URL:http://www.php.net:80/ [18212] - www.php.net/index.html [1] /search.php?show=nosourcepattern=%2Frobots.txt: Unknown/unsupported protocol. 10:22:34 URL:http://www.php.net:80/downloads.php [14415] - www.php.net/downloads.php [1] 10:22:36 URL:http://www.php.net:80/docs.php [27432] - www.php.net/docs.php [1] 10:22:39 URL:http://www.php.net:80/FAQ.php [76465] - www.php.net/FAQ.php [1] 10:22:40 URL:http://www.php.net:80/support.php [21866] - www.php.net/support.php [1] 10:22:41 URL:http://www.php.net:80/bugs.php [38831] - www.php.net/bugs.php [1] 10:22:42 URL:http://www.php.net:80/links.php [18090] - www.php.net/links.php [1] 10:22:43 URL:http://www.php.net:80/license/ [12410] - www.php.net/license/index.html [1] 10:22:44 URL:http://www.php.net:80/books.php [12035] - www.php.net/books.php [1] 10:22:46 URL:http://www.php.net:80/manual/en/ [33099] - www.php.net/manual/en/index.html [1] 10:22:46 URL:http://www.php.net:8000/manual/en/html/ [11043/11043] - www.php.net/manual/en/html/index.html [1] sysadmin@zeus:/usr/local/home/sysadmin/www.php.net$ ls -la total 260 drwxr-xr-x 5 sysadmin rbldev 4096 Jul 15 10:22 ./ drwx--x--x 13 sysadmin rbldev 4096 Jul 15 10:21 ../ -rw-r--r-- 1 sysadmin rbldev 76465 Jul 15 10:22 FAQ.php -rw-r--r-- 1 sysadmin rbldev 12035 Jul 15 10:22 books.php -rw-r--r-- 1 sysadmin rbldev 38831 Jul 15 10:22 bugs.php -rw-r--r-- 1 sysadmin rbldev 27432 Jul 15 10:22 docs.php -rw-r--r-- 1 sysadmin rbldev 14415 Jul 15 10:22 downloads.php -rw-r--r-- 1 sysadmin rbldev 18212 Jul 15 10:22 index.html drwxr-xr-x 2 sysadmin rbldev 4096 Jul 15 10:22 license/ -rw-r--r-- 1 sysadmin rbldev 18090 Jul 15 10:22 links.php drwxr-xr-x 12 sysadmin rbldev 4096 Jul 15 10:23 manual/ drwxr-xr-x 2 sysadmin rbldev 4096 Jul 15 10:21 stats/ -rw-r--r-- 1 sysadmin rbldev 21866 Jul 15 10:22 support.php sysadmin@zeus:/usr/local/home/sysadmin/www.php.net$ DAve -- Dave Goodrich Director of Interface Development Reality Based Learning Company 9521 NE Willows Road, Suite 100 Redmond, WA 98052 Toll Free 1-877-869-6603 ext. 237 Fax (425) 558-5655 [EMAIL PROTECTED] http://www.rblc.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]