Re: Faking a form POST
| From: | Shaun Martinec | Date: | Tue, 16 Apr 2002 12:26:57 +0000 |
| Subject: | Re: Faking a form POST | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93165@lists.php.net to get a copy of this message | ||
Check out the php docs for curl: http://www.php.net/manual/en/ref.curl.php
Maybe it's more of what you need. I use it with paypay autopay and such.
"Steve Dix" <steve@stevedix.de> wrote in message
news:3CBC2652.2995.4CD93C@localhost...
> On 16 Apr 2002 at 12:22, .ben wrote:
>
> > hmm, i was kinda after an in-process component like the ASP components
> > ASPHTTP (http://www.ServerObjects.com) and ASPTear
> > (http://www.alphasieraapapa.com).
> >
> > cheers tho,
> >
> > .b
> >
>
> Try this :
>
> You will have to encode your data in a similar manner to a get
> method, only without using the ? ie
>
> to send hello = 1, mouse=brown
>
> &hello=1&mouse=brown
>
> in $data_to_send
>
> <?
> function PostToHost($host, $path, $data_to_send)
> {
> $fp = fsockopen($host,80);
> fputs($fp, "POST $path HTTP/1.1\n");
> fputs($fp, "Host: $host\n");
> fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
> fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
> fputs($fp, "Connection: close\n\n");
> fputs($fp, $data_to_send);
> while(!feof($fp))
> {
> echo fgets($fp, 128);
> }
> fclose($fp);
> }
>
> ?>
> Steve Dix>==============================<steve@stevedix.de
> http://www.stevedix.de/
> http://www.snorty.net/
> http://www.mp3.com/simpletons
> http://www.geocities.com/motorcity/2706
>