|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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ý |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
[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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 > |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
[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. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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 > > > > > > |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
> -----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 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 > > > > > > |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
>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 > > |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
On Sat, 2008-09-27 at 21:37 -0700, Waynn Lue wrote:
> >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 > > > > > Without the action attribute, the form submits to itself, i.e. a form on contact.php submits to contact.php without an action attribute being specified. Ash www.ashleysheridan.co.uk |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
Ashley Sheridan wrote:
> Without the action attribute, the form submits to itself, i.e. a form > on contact.php submits to contact.php without an action attribute > being specified. Yes, not specifying the action attribute is the same as having an empty action attribute. I don't know if all browsers interpret it that way, but it does seem a reasonable assumption. /Per Jessen, Zürich |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
2008/9/28 Ashley Sheridan <ash@ashleysheridan.co.uk>:
>> 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. >> > Without the action attribute, the form submits to itself, i.e. a form on > contact.php submits to contact.php without an action attribute being > specified. > If it's undocumented then I would not rely upon it. How much trouble did we have in the early 00's because of sites that were coded for the undocumented 'features' of specific browsers five years prior? Additionally, if you cannot test all the varied platforms (PC, cellphones, iPhone, PS3, browsers for the disabled) then you should not rely on undocumented behaviour. Dotan Cohen http://what-is-what.com http://gibberish.co.il ×-ב-×’-ד-×”-ו-×–-×—-ט-×™-ך-×›-ל-×-מ-ן-×-ס-×¢-×£-פ-×¥-צ-×§-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
Not according to this:
http://www.w3.org/TR/html401/interac...ml#adef-action The only defined behaviour is when you specify a URI. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Lynch wrote: > Actually, I believe action="" submitting to the same URL is *documented* HTTP spec behavior. > > I welcome correction/confirmation if somebody wants to wade through the docs again... > > >> -----Original Message----- >> From: Dotan Cohen [mailto:dotancohen@gmail.com] >> Sent: Sunday, September 28, 2008 4:13 AM >> To: php-general@lists.php.net >> Subject: Re: [php] How to submit form via PHP >> >> 2008/9/28 Ashley Sheridan <ash@ashleysheridan.co.uk>: >> >>>> 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. >>>> >>>> >>> Without the action attribute, the form submits to itself, i.e. a form >>> >> on >> >>> contact.php submits to contact.php without an action attribute being >>> specified. >>> >>> >> If it's undocumented then I would not rely upon it. How much trouble >> did we have in the early 00's because of sites that were coded for the >> undocumented 'features' of specific browsers five years prior? >> Additionally, if you cannot test all the varied platforms (PC, >> cellphones, iPhone, PS3, browsers for the disabled) then you should >> not rely on undocumented behaviour. >> >> Dotan Cohen >> >> http://what-is-what.com >> http://gibberish.co.il >> ×-ב-×’-ד-×”-ו-×–-×—-ט-×™-ך-×›-ל-×-מ-ן-×-ס-×¢-×£-פ-×¥-צ-×§-ר-ש-ת >> >> ä-ö-ü-ß-Ä-Ö-Ü >> > > __________________________________________________ _____ > > The information in this email or in any file attached > hereto is intended only for the personal and confiden- > tial use of the individual or entity to which it is > addressed and may contain information that is propri- > etary and confidential. If you are not the intended > recipient of this message you are hereby notified that > any review, dissemination, distribution or copying of > this message is strictly prohibited. This communica- > tion is for information purposes only and should not > be regarded as an offer to sell or as a solicitation > of an offer to buy any financial product. Email trans- > mission cannot be guaranteed to be secure or error- > free. P6070214 > |
|
|
|
#15 |
|
Messages: n/a
Hébergeur: |
Micah Gersten a écrit :
> Not according to this: > http://www.w3.org/TR/html401/interac...ml#adef-action > > The only defined behaviour is when you specify a URI. The empty string into an HTML document is a valid relative URI ![]() According the same document gave (just follow the references ).-- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org |
|
|
|
#16 |
|
Messages: n/a
Hébergeur: |
On Mon, 2008-09-29 at 23:56 +0200, Lupus Michaelis wrote:
> Micah Gersten a écrit : > > Not according to this: > > http://www.w3.org/TR/html401/interac...ml#adef-action > > > > The only defined behaviour is when you specify a URI. > > The empty string into an HTML document is a valid relative URI > According the same document gave (just follow the references ).> > -- > Mickaël Wolff aka Lupus Michaelis > http://lupusmic.org > Do you have a reference for that, because I don't see it... Ash www.ashleysheridan.co.uk |
|
|
|
#17 |
|
Messages: n/a
Hébergeur: |
On Mon, 2008-09-29 at 23:40 +0100, Ashley Sheridan wrote:
> On Mon, 2008-09-29 at 23:56 +0200, Lupus Michaelis wrote: > > Micah Gersten a écrit : > > > Not according to this: > > > http://www.w3.org/TR/html401/interac...ml#adef-action > > > > > > The only defined behaviour is when you specify a URI. > > > > The empty string into an HTML document is a valid relative URI > > According the same document gave (just follow the references ).> > > > -- > > Mickaël Wolff aka Lupus Michaelis > > http://lupusmic.org > > > Do you have a reference for that, because I don't see it... > > > Ash > www.ashleysheridan.co.uk > > Sorry, my bad, I see it! Ash www.ashleysheridan.co.uk |
|
|
|
#18 |
|
Messages: n/a
Hébergeur: |
Ashley Sheridan a écrit :
From the link you gave, we stick on <http://www.w3.org/TR/html401/types.html#type-uri>, so it references an IETF RFC <http://www.ietf.org/rfc/rfc1808.txt> that describes what is an URI. The fourth section describes how we have to determine the resolution of an URI. The point that are in our scope is the next I quote : « a) If the embedded URL is entirely empty, it inherits the entire base URL (i.e., is set equal to the base URL) and we are done. » If you have any doubt, just enjoy reading the full document ![]() But for me, it is quite clear that an empty string is a valid URI *into* a document served by HTTP. -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org |
|
|
|
#19 |
|
Messages: n/a
Hébergeur: |
On Mon, 29 Sep 2008 11:33:41 -0500, Richard Lynch wrote:
> Actually, I believe action="" submitting to the same URL is *documented* HTTP spec behavior. > > I welcome correction/confirmation if somebody wants to wade through the docs again... HTML 4.01 says: action = uri [CT] This attribute specifies a form processing agent. User agent behavior for a value other than an HTTP URI is undefined. The "uri" is a reference to RFC 2396, which says: 4.2. Same-document References A URI reference that does not contain a URI is a reference to the current document. In other words, an empty URI reference within a document is interpreted as a reference to the start of that document, [For some reason, the syntax does not allow empty URI references. However, RFC 2396 has been obsoleted by RFC 3986 which /does/ allow empty URI references.] [And yes, the HTML spec should probably refer to URI *references* rather than URIs...] On the other hand, I seem to recall that it has been rumoured that some have claimed that browser support for empty action attribute is (or was) patchy. I don't know. /Nisse |
|
|
|
#20 |
|
Messages: n/a
Hébergeur: |
Lupus Michaelis wrote:
> Ashley Sheridan a écrit : > > From the link you gave, we stick on > <http://www.w3.org/TR/html401/types.html#type-uri>, so it references an > IETF RFC <http://www.ietf.org/rfc/rfc1808.txt> that describes what is an > URI. > > The fourth section describes how we have to determine the resolution > of an URI. The point that are in our scope is the next I quote : > > « > a) If the embedded URL is entirely empty, it inherits the > entire base URL (i.e., is set equal to the base URL) > and we are done. > » > > If you have any doubt, just enjoy reading the full document ![]() > > But for me, it is quite clear that an empty string is a valid URI > *into* a document served by HTTP. > I almost got used to the "schreefing" and now the "a écriting"! -Shawn |
|
|
|
#21 |
|
Messages: n/a
Hébergeur: |
Hm, it specifies base though. Does that mean the full query string
won't be guaranteed to be passed along? On 9/29/08, Lupus Michaelis <mickael+php@lupusmic.org> wrote: > Ashley Sheridan a écrit : > > From the link you gave, we stick on > <http://www.w3.org/TR/html401/types.html#type-uri>, so it references an > IETF RFC <http://www.ietf.org/rfc/rfc1808.txt> that describes what is an > URI. > > The fourth section describes how we have to determine the resolution > of an URI. The point that are in our scope is the next I quote : > > « > a) If the embedded URL is entirely empty, it inherits the > entire base URL (i.e., is set equal to the base URL) > and we are done. > » > > If you have any doubt, just enjoy reading the full document ![]() > > But for me, it is quite clear that an empty string is a valid URI > *into* a document served by HTTP. > > -- > Mickaël Wolff aka Lupus Michaelis > http://lupusmic.org > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > |
|
![]() |
| Outils de la discussion | |
|
|