POSTing to my own scripts

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default 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 ([url]http://www.php.net/stream[/url]), 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?
    Steven Stern Guest

  2. Similar Questions and Discussions

    1. not posting
      can someone elaborate on why this code is not working: #! Perl\bin\perl -w use strict; $|++; use WWW::Mechanize; my $mech =...
    2. CS: Scripts do not appear in Scripts menu
      I have several utility AppleScripts that I created for Illustrator 10. I'd like to use these in CS, and they work correctly when I choose "Browse"...
    3. XML posting
      I wan't to send a string containing XML to a Microsoft XML gateway. I'm using the include code below as an include and calling the function with...
    4. scripts that control other scripts
      Is there any behaviour script that when attached to a sprite can control the functionality of any other scripts attached to that sprite? I want to...
    5. Re Posting this Pls Help
      I have reposted this in the hope some one can help. If it has been covered before I apologise but I cannot find an answer to this problem. I...
  3. #2

    Default Re: POSTing to my own scripts

    On Wed, 15 Sep 2004 13:42:31 GMT, Steven Stern
    <sdsternNOSPAMHERE@NOSPAMHEREmindspring.com> wrote:
    >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 ([url]http://www.php.net/stream[/url]), 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?
    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: [url]http://uk.php.net/curl[/url] but I've
    never used it.

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

  4. #3

    Default Re: POSTing to my own scripts

    Hello,

    On 09/15/2004 10:42 AM, Steven Stern wrote:
    > 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 ([url]http://www.php.net/stream[/url]), 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?
    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.

    [url]http://www.phpclasses.org/httpclient[/url]


    --

    Regards,
    Manuel Lemos

    PHP Classes - Free ready to use OOP components written in PHP
    [url]http://www.phpclasses.org/[/url]

    PHP Reviews - Reviews of PHP books and other products
    [url]http://www.phpclasses.org/reviews/[/url]

    Metastorage - Data object relational mapping layer generator
    [url]http://www.meta-language.net/metastorage.html[/url]
    Manuel Lemos Guest

  5. #4

    Default Re: POSTing to my own scripts

    On Wed, 15 Sep 2004 15:42:08 -0300 (more or less), Manuel Lemos
    <mlemos@acm.org> wrote:
    >Hello,
    >
    >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.
    >
    >[url]http://www.phpclasses.org/httpclient[/url]

    THANKS
    Steven Stern Guest

  6. #5

    Default Re: POSTing to my own scripts

    Steven Stern <sdsternNOSPAMHERE@NOSPAMHEREmindspring.com> wrote in message news:<afhgk0t9atclcqiv67gepmus6d1k2ga9qm@4ax.com>. ..
    > 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 ([url]http://www.php.net/stream[/url]), 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?
    [url]http://in2.php.net/fsockopen[/url]
    > 2. Is there a better way?
    [url]http://in.php.net/curl[/url]

    --
    | Just another PHP saint |
    Email: rrjanbiah-at-Y!com
    R. Rajesh Jeba Anbiah Guest

  7. #6

    Default Re: POSTing to my own scripts

    Steven Stern wrote:
    > 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 ([url]http://www.php.net/stream[/url]), 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?
    You should look at the curl module. It nicely encapsulates this.

    --
    David G. Risner
    Software Engineer, California State University, Los Angeles
    [url]http://www.risner.org/david/[/url]
    David Risner Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139