Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

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

Report this thread to moderator Post Follow-up to this message
Old Post
Steven Stern
09-15-04 08:56 PM


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

Report this thread to moderator Post Follow-up to this message
Old Post
Andy Hassall
09-15-04 08:57 PM


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

Report this thread to moderator Post Follow-up to this message
Old Post
Manuel Lemos
09-15-04 08:57 PM


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.
>
>http://www.phpclasses.org/httpclient


THANKS

Report this thread to moderator Post Follow-up to this message
Old Post
Steven Stern
09-16-04 02:22 AM


Re: POSTing to my own scripts
Steven 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

Report this thread to moderator Post Follow-up to this message
Old Post
R. Rajesh Jeba Anbiah
09-16-04 09:52 AM


Re: POSTing to my own scripts
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?
>
> 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/

Report this thread to moderator Post Follow-up to this message
Old Post
David Risner
09-17-04 01:32 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:10 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.