Re: HTTP POST
| From: | Andrew Brampton | Date: | Fri, 13 Sep 2002 19:21:20 +0000 |
| Subject: | Re: HTTP POST | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116304@lists.php.net to get a copy of this message | ||
There are a few ways of posting data from PHP, the prefered way is using
the curl libs, but the method I prefer is using sockets like so:
<?php$fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "POST / HTTP/1.0\r\n\r\n");
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>
(taken from the PHP Manual)
You may want to also add some addation lines of data to send (ie the
content of the form)
Hope this helps
Andrew
----- Original Message -----
From: "news.php.net" <krtye@synaptech-software.com>
To: <php-general@lists.php.net>
Sent: Friday, September 13, 2002 7:57 PM
Subject: [PHP] HTTP POST
> I'm a bit of a newbie to PHP and web applications so forgive me if this
is
> pretty basic. I need to send an HTTP POST to another website that is
> supposed to respond back to the post with a simple string containing
either
> "VERIFIED" or "INVALID". I really don't understand how to do this,
however.
> I know how to get variables from forms that send me a post, but have now
> clue how to read the response to a post that I send from a script. I
didn't
> have any luck finding this in the documentation either, so any help
would be
> appreciated.
>
> Best Regards,
>
> Kevin
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>