473,511 Members | 13,618 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/getAllPathsForDomain 'thesecondroad.org' | /etc/
findFilesUpdatedInLast24Hours

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

Feb 8 '08 #1
6 2425
On Feb 7, 10:24 pm, lawrence k <lkrub...@geocities.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/getAllPathsForDomain 'thesecondroad.org' | /etc/
findFilesUpdatedInLast24Hours

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/getAllPathsForDomain 'thesecondroad.org' | /etc/
findFilesUpdatedInLast24Hours

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.dewrote:
.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/getAllPathsForDomain 'thesecondroad.org' | /etc/
findFilesUpdatedInLast24Hours
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/getAllPathsForDomain
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...@tobyinkster.co.uk>
wrote:
lawrence k wrote:
/etc/getAllPathsForDomain

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...@tobyinkster.co.uk>
wrote:
>lawrence k wrote:
/etc/getAllPathsForDomain

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
9187
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
5189
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...
10
5324
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...
0
1371
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...
7
3691
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...
1
1264
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...
14
19690
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
7796
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
1631
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...
0
7251
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,...
0
7367
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,...
0
7517
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...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
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...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
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...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
790
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.