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@xxxxxxxxxx]
Sent: Friday, August 15, 2008 11:31 AM
To: pe.ve.ce@xxxxxxxxx; php-general@xxxxxxxxxxxxx
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


.



Relevant Pages

  • Re: HELP: strange php behavior downloading html
    ... problem in less than an hour, using cURL with PHP. ... Here is the function I wrote to download a uri into a file (following ... all redirects, ignoring old cookies, and passing set cookies to redirects): ...
    (comp.lang.php)
  • Re: [PHP] PHP 5 file_get_contents() problems
    ... I created a simple set of curl functions which just printed a remote url to ... This tested well on an alternate test site which has PHP ... The given remote host was not resolved. ... So I'm lead to believe there is some other PHP configuration (or server ...
    (php.general)
  • Re: curl problems
    ... i've got problems getting php4 scripts which use curl to work on RHEL4 ... curl in php works with a selfcompiled php5 binary executed via cgi on ... when the browser prompts for saving, it's because the server says so ...
    (comp.lang.php)
  • Re: Auto submitting a form that contains a file field
    ... Client end is NOT php. ...  Thanks, - Dave ... post-file in wget or the equivalent in CURL to do the thing. ...
    (comp.lang.php)
  • RE: [PHP] Help needed with Curl
    ... The script is the same on both machines. ... I downloaded a copy of PHP Version 5.2.3 and installed it on Windows ... Everything seems to work fine except for Curl. ... cURL Information libcurl/7.16.0 OpenSSL/0.9.8e zlib/1.2.3 ...
    (php.general)