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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence k

    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?



  • ZeldorBlat

    #2
    Re: how do arrays pipe from one PHP shell script to another?

    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.

    Comment

    • Michael Fesser

      #3
      Re: how do arrays pipe from one PHP shell script to another?

      ..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

      Comment

      • lawrence k

        #4
        Re: how do arrays pipe from one PHP shell script to another?

        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?






        Comment

        • Toby A Inkster

          #5
          Re: how do arrays pipe from one PHP shell script to another?

          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

          Comment

          • lawrence k

            #6
            Re: how do arrays pipe from one PHP shell script to another?

            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?

            Comment

            • Michael Fesser

              #7
              Re: how do arrays pipe from one PHP shell script to another?

              ..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

              Comment

              Working...