473,587 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do arrays pipe from one PHP shell script to another?


Suppose I have a PHP script that I call at the Linux command line
(Ubuntu), and it gets all the paths to files and directories that
exist inside of some directory. All this data gets stored in an array.
How do I get this array to another PHP shell script? Can I use pipe?

/etc/getAllPathsForD omain 'thesecondroad. org' | /etc/
findFilesUpdate dInLast24Hours

Is the syntax basically right? Is this how I should build it?

Feb 8 '08 #1
6 2432
On Feb 7, 10:24 pm, lawrence k <lkrub...@geoci ties.comwrote:
Suppose I have a PHP script that I call at the Linux command line
(Ubuntu), and it gets all the paths to files and directories that
exist inside of some directory. All this data gets stored in an array.
How do I get this array to another PHP shell script? Can I use pipe?

/etc/getAllPathsForD omain 'thesecondroad. org' | /etc/
findFilesUpdate dInLast24Hours

Is the syntax basically right? Is this how I should build it?
You could do it this way using serialize(), echo, $_SERVER['argv'],
and unserialize().

I don't know what your specific project is like, but you can probably
solve your problem using include() or require() -- which will be much
easier and faster.
Feb 8 '08 #2
..oO(lawrence k)
>Suppose I have a PHP script that I call at the Linux command line
(Ubuntu), and it gets all the paths to files and directories that
exist inside of some directory. All this data gets stored in an array.
How do I get this array to another PHP shell script? Can I use pipe?

/etc/getAllPathsForD omain 'thesecondroad. org' | /etc/
findFilesUpdat edInLast24Hours

Is the syntax basically right? Is this how I should build it?
The array should be serialized and written to php://stdout (print or
echo). The second script can then read the input from php://stdin with
one of the various file system functions and unserialize the data.

HTH
Micha
Feb 8 '08 #3
On Feb 7, 10:53 pm, Michael Fesser <neti...@gmx.de wrote:
.oO(lawrence k)
Suppose I have a PHP script that I call at the Linux command line
(Ubuntu), and it gets all the paths to files and directories that
exist inside of some directory. All this data gets stored in an array.
How do I get this array to another PHP shell script? Can I use pipe?
/etc/getAllPathsForD omain 'thesecondroad. org' | /etc/
findFilesUpdate dInLast24Hours
Is the syntax basically right? Is this how I should build it?

The array should be serialized and written to php://stdout (print or
echo). The second script can then read the input from php://stdin with
one of the various file system functions and unserialize the data.
Thanks, I'm trying to run a cron job that will run once a day. What is
the syntax of php://stdout? Is this something I put at the end of the
first script, and then php://stdin is a line that I place at the
beginning of the second script? If I do this, do I still need to do
use pipe? Or do I just forget about that?


Feb 8 '08 #4
lawrence k wrote:
/etc/getAllPathsForD omain
It's probably not a good idea to put arbitrary executables inside /etc/.
Use /usr/local/bin/ instead -- that's what it's there for.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 9 days, 16:09.]

The Great IE8 Meta Tag Debacle
http://tobyinkster.co.uk/blog/2008/02/06/ie-8-meta-tag/
Feb 8 '08 #5
On Feb 8, 4:53 am, Toby A Inkster <usenet200...@t obyinkster.co.u k>
wrote:
lawrence k wrote:
/etc/getAllPathsForD omain

It's probably not a good idea to put arbitrary executables inside /etc/.
Use /usr/local/bin/ instead -- that's what it's there for.
Thanks, Toby. I did not know that. I'll move the scripts.

If you don't mind me asking, what is /etc/ mostly for?

Feb 9 '08 #6
..oO(lawrence k)
>On Feb 8, 4:53 am, Toby A Inkster <usenet200...@t obyinkster.co.u k>
wrote:
>lawrence k wrote:
/etc/getAllPathsForD omain

It's probably not a good idea to put arbitrary executables inside /etc/.
Use /usr/local/bin/ instead -- that's what it's there for.

Thanks, Toby. I did not know that. I'll move the scripts.

If you don't mind me asking, what is /etc/ mostly for?
Configuration files and system scripts for start-up and initialization.

Micha
Feb 10 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9213
by: funtoosh | last post by:
Hi Scenario: I have a shell script e.g. a.bash This script wraps a program called "generate" like this: generate > /tmp/y.txt 2>&1 # both stdout and stderr r redirected to y.txt
1
5196
by: momena | last post by:
Hi experts, I need to write a perl script that will be called from a series of executables chained thru pipes that read from STDIN and writes to STDOUT. The following code works fine under regular circumstance. But when there is a error down the pipe in one of the executables, the pipe closes and then this script just exits. It does not print...
10
5346
by: seema_coma | last post by:
Iam working on Client, Server programming on Linux in C++. I have a Server Daemon running in the background, my client program talks to the Server and extracts some data which I am printing on the screen. This thing works fine but when i redirect the stdout to pipe it hangs for eternity, for example, seema@coma> simple_client | more
0
1374
by: Tom Brown | last post by:
I need to chain together three linux commands and get the final output. I read the documentation for Popen in the subprocess module for replacing the shell pipe line. I followed the example and keep getting a 0 where I should be getting a 1. I am trying to do this: grep "Sep 22" /var/log/auth.log | grep "Illegal user" | wc -l which returns...
7
3697
by: Greg | last post by:
I am trying to implement the UNIX pipe command using C but with the "->" operator. Everything works fine with 1 pipe, but when I try to use 2 or more, it hangs up when reading the pipe_in filestream. If ANYONE could offer ANY suggestion as to why this is happening it would be much appreciated. Thanks in advance!
1
1268
by: David Reed | last post by:
Is there any way to have one program run another arbitrary program with input from stdin and display the output as if you had run it in a shell (i.e., you'd see some of the output followed by the input they typed in and then a newline because they pressed return followed by subsequent output, etc.). I can't use readline with the pipe...
14
19732
by: Rochester | last post by:
Hi, I just found out that the general open file mechanism doesn't work for named pipes (fifo). Say I wrote something like this and it simply hangs python: #!/usr/bin/python import os
21
7817
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
8
1642
by: Jim B. Wilson | last post by:
I have the mother (of all) application(s, written in C++) that occasionally outsources certain tasks to a child Python script. The mother fork/execs (or equivalent) the child and then begins serving the child's requests. The child/client sends requests on its stdout and receives responses on stdin. The interaction is facilitated by a...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.