Home > Archive > PHP Language > September 2004 > POSTing to my own scripts
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
POSTing to my own scripts
|
|
| Steven Stern 2004-09-15, 3:56 pm |
| 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?
| |
| Andy Hassall 2004-09-15, 3:57 pm |
| 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 (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?
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.andyhsoftware.co.uk/space> Space: disk usage analysis tool
| |
| Manuel Lemos 2004-09-15, 3:57 pm |
| 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 (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?
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
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
| |
| Steven Stern 2004-09-15, 9:22 pm |
| 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.
>
>http://www.phpclasses.org/httpclient
THANKS
| |
| R. Rajesh Jeba Anbiah 2004-09-16, 4:52 am |
| 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 (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?
http://in2.php.net/fsockopen
> 2. Is there a better way?
http://in.php.net/curl
--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
| |
| David Risner 2004-09-16, 8:32 pm |
| 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 (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?
You should look at the curl module. It nicely encapsulates this.
--
David G. Risner
Software Engineer, California State University, Los Angeles
http://www.risner.org/david/
|
|
|
|
|