Bluehost.com Web Hosting $6.95

How to submit form via PHP

This is a discussion on How to submit form via PHP within the PHP General forums, part of the PHP Programming Forums category; Hello. I'm pretty noob in PHP and would like to know how can I submit some HTML form got ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-01-1970
pe.ve.ce@seznam.cz
 
Posts: n/a
Default How to submit form via PHP

Hello. I'm pretty noob in PHP and would like to know how can I submit some HTML form got via file_get_contents(URL). For example:

<form name="someform" method="post">
<input type="submit">
</form>

so how can I submit 'someform' form.

Thanks in advance for any suggestions.

Matěj "czech_d3v3l0p3r" Grabovský
Reply With Quote
  #2 (permalink)  
Old 08-15-2008
Jay Blanchard
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

[snip]
Hello. I'm pretty noob in PHP and would like to know how can I submit
some HTML form got via file_get_contents(URL). For example:

<form name="someform" method="post">
<input type="submit">
</form>

so how can I submit 'someform' form.

Thanks in advance for any suggestions.
[/snip]

Click 'Submit'



Your form tag needs an action statement

<form name="someform" action="some.php" method="POST">

All of the form's variables will be available in the $_POST array
Reply With Quote
  #3 (permalink)  
Old 08-15-2008
Robert Cummings
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

On Fri, 2008-08-15 at 13:30 -0500, Jay Blanchard wrote:
> [snip]
> Hello. I'm pretty noob in PHP and would like to know how can I submit
> some HTML form got via file_get_contents(URL). For example:
>
> <form name="someform" method="post">
> <input type="submit">
> </form>
>
> so how can I submit 'someform' form.
>
> Thanks in advance for any suggestions.
> [/snip]
>
> Click 'Submit'
>
>
>
> Your form tag needs an action statement


No it doesn't... without an action statement it will submit to the same
URL in which it was presented.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

Reply With Quote
  #4 (permalink)  
Old 08-15-2008
Warren Vail
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

Key to this one may be understanding what is being asked. I think pe.ve.ce
performed a file read (file_get_contents) on the form from another website
and wants to be able to simulate a browser submit from his code.

If this is correct, I would recommend you take a look at CURL. There are
probably several approaches that work, but as I understand that CURL is an
implementation of the C libraries used by early browsers. If that is not
correct, someone here will set us straight. Many ISP's won't support CURL,
because it is often used for questionable activities and considered a
security exposure, but I believe CURL is what you want.

Hth,

Warren Vail

> -----Original Message-----
> From: Jay Blanchard [mailto:jblanchard@pocket.com]
> Sent: Friday, August 15, 2008 11:31 AM
> To: pe.ve.ce@seznam.cz; php-general@lists.php.net
> Subject: RE: [php] How to submit form via PHP
>
> [snip]
> Hello. I'm pretty noob in PHP and would like to know how can
> I submit some HTML form got via file_get_contents(URL). For example:
>
> <form name="someform" method="post">
> <input type="submit">
> </form>
>
> so how can I submit 'someform' form.
>
> Thanks in advance for any suggestions.
> [/snip]
>
> Click 'Submit'
>
>
>
> Your form tag needs an action statement
>
> <form name="someform" action="some.php" method="POST">
>
> All of the form's variables will be available in the $_POST array
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>


Reply With Quote
  #5 (permalink)  
Old 08-15-2008
Jay Blanchard
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

[snip]
On Fri, 2008-08-15 at 13:30 -0500, Jay Blanchard wrote:
> [snip]
> Hello. I'm pretty noob in PHP and would like to know how can I submit
> some HTML form got via file_get_contents(URL). For example:
>
> <form name="someform" method="post">
> <input type="submit">
> </form>
>
> so how can I submit 'someform' form.
>
> Thanks in advance for any suggestions.
> [/snip]
>
> Click 'Submit'
>
>
>
> Your form tag needs an action statement


No it doesn't... without an action statement it will submit to the same
URL in which it was presented.
[/snip]

True, I was just eyeballs deep in coding something and answered much too
quickly.
Reply With Quote
  #6 (permalink)  
Old 08-15-2008
pe.ve.ce@seznam.cz
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

Thanks, that was what I needed. Also I found this: http://curl.haxx.se/libcurl/php/exam...implepost.html. Is it somehow possible to retrieve result of that operation?

Thanks in advance.

Matěj "czech_d3v3l0pr" Grabovský


> ------------ Původní zpráva ------------
> Od: Warren Vail <warren@vailtech.net>
> Předmět: RE: [php] How to submit form via PHP
> Datum: 15.8.2008 21:04:12
> ----------------------------------------
> Key to this one may be understanding what is being asked. I think pe..ve.ce
> performed a file read (file_get_contents) on the form from another website
> and wants to be able to simulate a browser submit from his code.
>
> If this is correct, I would recommend you take a look at CURL. Thereare
> probably several approaches that work, but as I understand that CURL is an
> implementation of the C libraries used by early browsers. If that isnot
> correct, someone here will set us straight. Many ISP's won't supportCURL,
> because it is often used for questionable activities and considered a
> security exposure, but I believe CURL is what you want.
>
> Hth,
>
> Warren Vail
>
> > -----Original Message-----
> > From: Jay Blanchard [mailto:jblanchard@pocket.com]
> > Sent: Friday, August 15, 2008 11:31 AM
> > To: pe.ve.ce@seznam.cz; php-general@lists.php.net
> > Subject: RE: [php] How to submit form via PHP
> >
> > [snip]
> > Hello. I'm pretty noob in PHP and would like to know how can
> > I submit some HTML form got via file_get_contents(URL). For example:
> >
> > <form name="someform" method="post">
> > <input type="submit">
> > </form>
> >
> > so how can I submit 'someform' form.
> >
> > Thanks in advance for any suggestions.
> > [/snip]
> >
> > Click 'Submit'
> >
> >
> >
> > Your form tag needs an action statement
> >
> > <form name="someform" action="some.php" method="POST">
> >
> > All of the form's variables will be available in the $_POST array
> >
> > --
> > PHP General Mailing List (http://www.php.net/) To
> > unsubscribe, visit: http://www.php.net/unsub.php
> >

>
>
>
>

Reply With Quote
  #7 (permalink)  
Old 08-15-2008
Boyd, Todd M.
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

> -----Original Message-----
> From: pe.ve.ce@seznam.cz [mailto:pe.ve.ce@seznam.cz]
> Sent: Friday, August 15, 2008 2:54 PM
> To: php-general@lists.php.net
> Subject: RE: [php] How to submit form via PHP
>
> Thanks, that was what I needed. Also I found this:
> http://curl.haxx.se/libcurl/php/examples/./simplepost.html. Is it
> somehow possible to retrieve result of that operation?
>
> Thanks in advance.
>
> Matěj "czech_d3v3l0pr" Grabovský


I believe:

curl_setopt(CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);

....will send the output from cURL to the variable rather than the web browser/screen.


Todd Boyd
Web Programmer



Reply With Quote
  #8 (permalink)  
Old 08-16-2008
pe.ve.ce@seznam.cz
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

Many thanks, Todd, and others.

Matěj "czech_d3vl0p3r" Grabovský

> ------------ Původní zpráva ------------
> Od: Boyd, Todd M. <tmboyd1@ccis.edu>
> Předmět: RE: [php] How to submit form via PHP
> Datum: 15.8.2008 22:43:40
> ----------------------------------------
> > -----Original Message-----
> > From: pe.ve.ce@seznam.cz [mailto:pe.ve.ce@seznam.cz]
> > Sent: Friday, August 15, 2008 2:54 PM
> > To: php-general@lists.php.net
> > Subject: RE: [php] How to submit form via PHP
> >
> > Thanks, that was what I needed. Also I found this:
> > http://curl.haxx.se/libcurl/php/examples/./simplepost.html. Is it
> > somehow possible to retrieve result of that operation?
> >
> > Thanks in advance.
> >
> > Matěj "czech_d3v3l0pr" Grabovský

>
> I believe:
>
> curl_setopt(CURLOPT_RETURNTRANSFER, true);
> $result = curl_exec($ch);
>
> ...will send the output from cURL to the variable rather than the web
> browser/screen.
>
>
> Todd Boyd
> Web Programmer
>
>
>
>
>
>

Reply With Quote
  #9 (permalink)  
Old 08-17-2008
tedd
 
Posts: n/a
Default RE: [PHP] How to submit form via PHP

At 2:39 PM -0400 8/15/08, Robert Cummings wrote:
>On Fri, 2008-08-15 at 13:30 -0500, Jay Blanchard wrote:
> > Your form tag needs an action statement

>
>No it doesn't... without an action statement it will submit to the same
>URL in which it was presented.
>
>Cheers,
>Rob.


Rob:

There you go again -- I've been submitting forms for over a decade
and didn't know that.

There's nothing more annoying than someone who's always teaching you
something. :-)

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
  #10 (permalink)  
Old 09-28-2008
Waynn Lue
 
Posts: n/a
Default Re: [PHP] How to submit form via PHP

>No it doesn't... without an action statement...

Sorry to drag up an old thread, but I just saw this. Is that true of
all browsers? I'm wondering because I just coded a site to use this
behavior, then I saw that the html specification says the action
attribute is required.

Thanks,
Waynn

On 8/15/08, Robert Cummings <robert@interjinn.com> wrote:
> On Fri, 2008-08-15 at 13:30 -0500, Jay Blanchard wrote:
>> [snip]
>> Hello. I'm pretty noob in PHP and would like to know how can I submit
>> some HTML form got via file_get_contents(URL). For example:
>>
>> <form name="someform" method="post">
>> <input type="submit">
>> </form>
>>
>> so how can I submit 'someform' form.
>>
>> Thanks in advance for any suggestions.
>> [/snip]
>>
>> Click 'Submit'
>>
>>
>>
>> Your form tag needs an action statement

>
> No it doesn't... without an action statement it will submit to the same
> URL in which it was presented.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0