473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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?
Jul 17 '05 #1
6 1561
On Wed, 15 Sep 2004 13:42:31 GMT, Steven Stern
<sd***************@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 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
http://digiserv.net/
Jul 17 '05 #2
On Wed, 15 Sep 2004 13:42:31 GMT, Steven Stern
<sd***************@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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #3
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
Jul 17 '05 #4
On Wed, 15 Sep 2004 15:42:08 -0300 (more or less), Manuel Lemos
<ml****@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
Jul 17 '05 #5
Steven Stern <sd***************@NOSPAMHEREmindspring.com> wrote in message news:<af********************************@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
Jul 17 '05 #6
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/
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gary Stark | last post by:
Does anyone have such a beastie? I can't even get to first base. The following doesn't work ... $hostNNTP = "news.swiftdsl.com.au:119/nntp"; $nntp = imap_open( "{" . $hostNNTP ....
2
by: Jonathan M. Rose | last post by:
I am looking for a script that I can sit on an HTML server (Linux, Apache, PHP/Perl/Python/Etc.) that will allow me to do the following things: 1) Post news articles that consists of (i) a title...
8
by: Sergio Otoya | last post by:
Hi all, I need to add an input hidden field to an existing form (post). I have tried a couple things like adding the '<INPUT type=hidden name=idSelectedURL value=http://server/documents>' to...
11
by: Mark A | last post by:
Here is Mark Townsend's (Oracle Product Manager) explanation and justification for posting in the DB2 newsgroup, as posted on the Oracle newsgroup, and my response: "Mark Townsend"...
7
by: louise raisbeck | last post by:
Hi, I'm sure this is a standard thing. I have a web form with several input boxes/drop down lists and checkboxes. They all represent a field within a sql table and I need the user to update the...
4
by: _wolf | last post by:
hi all, this is a re-posting of my question i asked a month or so ago. i installed web.py, flups, and cheetah. when i copy'n'paste the sample app from then http://webpy.org homepage :: import...
1
by: ponsibabu | last post by:
We have several scripts for sale. We are selling them at reasonable prices and willing to work around your budget. For more information please contact totascriptz@yahoo.com with "Scripts" as...
2
by: Norman Peelman | last post by:
From: "Norman Peelman" <npeelman@cfl.rr.com> Subject: Re: posting form data to two php scripts at once Date: Sunday, December 17, 2006 12:06 AM <one.1more@gmail.comwrote in message...
0
numberwhun
by: numberwhun | last post by:
Please remember the following when posting a question in the Perl Forum. Doing so will get you better assistance. Provide Sample Code - You will find that this is asked for more often than not....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.