Code Comments
Programming Forum and web based access to our favorite programming groups.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 f or 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, somethin g that I pass an array of field names and values along with the target URL? 2. Is there a better way?
Post Follow-up to this messageOn 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, somethi ng >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 excellen t, 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
Post Follow-up to this messageHello, On 09/15/2004 10:42 AM, Steven Stern wrote: > I've got some scripts that back-end multiple HTML forms, accepting data vi a > POST. What I'd like to do is have some automated processing take place vi a > 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, someth ing > 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
Post Follow-up to this messageOn 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
Post Follow-up to this messageSteven Stern <sdsternNOSPAMHERE@NOSPAMHEREmindspring.com> wrote in message news:<afhgk0t9at clcqiv67gepmus6d1k2ga9qm@4ax.com>... > I've got some scripts that back-end multiple HTML forms, accepting data vi a > POST. What I'd like to do is have some automated processing take place vi a > 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, someth ing > 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
Post Follow-up to this messageSteven Stern wrote: > I've got some scripts that back-end multiple HTML forms, accepting data vi a > POST. What I'd like to do is have some automated processing take place vi a > 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, someth ing > 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/
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.