POSTing to my own scripts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steven Stern

    POSTing to my own scripts

    I've got some scripts that back-end multiple HTML forms, accepting data via
    POST. What I'd like to do is have some automated processing take place via
    cron, using those same scripts to do the back-end processing. I'm looking for
    a way to invoke those scripts from a script *not* executed via a browser
    session.

    I've found one way via streams (http://www.php.net/stream), by creating a
    pretend browser session.

    1. Is there an easy-to-use class that encapsulates this? That is, something
    that I pass an array of field names and values along with the target URL?

    2. Is there a better way?
  • Ian.H

    #2
    Re: POSTing to my own scripts

    On Wed, 15 Sep 2004 13:42:31 GMT, Steven Stern
    <sdsternNOSPAMH ERE@NOSPAMHEREm indspring.com> wrote:
    [color=blue]
    >I've got some scripts that back-end multiple HTML forms, accepting data via
    >POST. What I'd like to do is have some automated processing take place via
    >cron, using those same scripts to do the back-end processing. I'm looking for
    >a way to invoke those scripts from a script *not* executed via a browser
    >session.
    >
    >I've found one way via streams (http://www.php.net/stream), by creating a
    >pretend browser session.
    >
    >1. Is there an easy-to-use class that encapsulates this? That is, something
    >that I pass an array of field names and values along with the target URL?
    >
    >2. Is there a better way?[/color]



    If you can't use an external browser (Lynx for example) I'd probably
    personally use the LWP::Simple module in a small Perl script and exec
    that from a cronjob. I have a few that do GET for updating scripts, but
    could easily be done for POST data (including using cookies if required
    etc etc).

    I don't use PHP for "system" based scripting.. so haven't looked into
    this for PHP.



    Regards,

    Ian

    --
    Ian.H
    digiServ Network
    London, UK

    Comment

    • Andy Hassall

      #3
      Re: POSTing to my own scripts

      On Wed, 15 Sep 2004 13:42:31 GMT, Steven Stern
      <sdsternNOSPAMH ERE@NOSPAMHEREm indspring.com> wrote:
      [color=blue]
      >I've got some scripts that back-end multiple HTML forms, accepting data via
      >POST. What I'd like to do is have some automated processing take place via
      >cron, using those same scripts to do the back-end processing. I'm looking for
      >a way to invoke those scripts from a script *not* executed via a browser
      >session.
      >
      >I've found one way via streams (http://www.php.net/stream), by creating a
      >pretend browser session.
      >
      >1. Is there an easy-to-use class that encapsulates this? That is, something
      >that I pass an array of field names and values along with the target URL?
      >
      >2. Is there a better way?[/color]

      If you want automated posting, then Perl's WWW::Mechanize module is excellent,
      or the LWP module for a lower-level approach.

      For a PHP solution, then I think there's cURL: http://uk.php.net/curl but I've
      never used it.

      --
      Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
      <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

      Comment

      • Manuel Lemos

        #4
        Re: POSTing to my own scripts

        Hello,

        On 09/15/2004 10:42 AM, Steven Stern wrote:[color=blue]
        > I've got some scripts that back-end multiple HTML forms, accepting data via
        > POST. What I'd like to do is have some automated processing take place via
        > cron, using those same scripts to do the back-end processing. I'm looking for
        > a way to invoke those scripts from a script *not* executed via a browser
        > session.
        >
        > I've found one way via streams (http://www.php.net/stream), by creating a
        > pretend browser session.
        >
        > 1. Is there an easy-to-use class that encapsulates this? That is, something
        > that I pass an array of field names and values along with the target URL?[/color]

        This class does exactly what you ask, it submits forms with POST,
        including submitting large files if necessary, it can collect cookies
        and redirection if you need to emulate a login session.




        --

        Regards,
        Manuel Lemos

        PHP Classes - Free ready to use OOP components written in PHP
        Free PHP Classes and Objects 2026 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


        PHP Reviews - Reviews of PHP books and other products


        Metastorage - Data object relational mapping layer generator

        Comment

        • Steven Stern

          #5
          Re: POSTing to my own scripts

          On Wed, 15 Sep 2004 15:42:08 -0300 (more or less), Manuel Lemos
          <mlemos@acm.org > wrote:
          [color=blue]
          >Hello,[/color]
          [color=blue]
          >
          >This class does exactly what you ask, it submits forms with POST,
          >including submitting large files if necessary, it can collect cookies
          >and redirection if you need to emulate a login session.
          >
          >http://www.phpclasses.org/httpclient[/color]


          THANKS

          Comment

          • R. Rajesh Jeba Anbiah

            #6
            Re: POSTing to my own scripts

            Steven Stern <sdsternNOSPAMH ERE@NOSPAMHEREm indspring.com> wrote in message news:<afhgk0t9a tclcqiv67gepmus 6d1k2ga9qm@4ax. com>...[color=blue]
            > I've got some scripts that back-end multiple HTML forms, accepting data via
            > POST. What I'd like to do is have some automated processing take place via
            > cron, using those same scripts to do the back-end processing. I'm looking for
            > a way to invoke those scripts from a script *not* executed via a browser
            > session.
            >
            > I've found one way via streams (http://www.php.net/stream), by creating a
            > pretend browser session.
            >
            > 1. Is there an easy-to-use class that encapsulates this? That is, something
            > that I pass an array of field names and values along with the target URL?[/color]

            Open Internet or Unix domain socket connection

            [color=blue]
            > 2. Is there a better way?[/color]



            --
            | Just another PHP saint |
            Email: rrjanbiah-at-Y!com

            Comment

            • David Risner

              #7
              Re: POSTing to my own scripts

              Steven Stern wrote:[color=blue]
              > I've got some scripts that back-end multiple HTML forms, accepting data via
              > POST. What I'd like to do is have some automated processing take place via
              > cron, using those same scripts to do the back-end processing. I'm looking for
              > a way to invoke those scripts from a script *not* executed via a browser
              > session.
              >
              > I've found one way via streams (http://www.php.net/stream), by creating a
              > pretend browser session.
              >
              > 1. Is there an easy-to-use class that encapsulates this? That is, something
              > that I pass an array of field names and values along with the target URL?
              >
              > 2. Is there a better way?[/color]

              You should look at the curl module. It nicely encapsulates this.

              --
              David G. Risner
              Software Engineer, California State University, Los Angeles
              Войдите на Facebook, чтобы общаться с друзьями, родственниками и знакомыми.

              Comment

              Working...