Thanks to everyone who helped out with this question, got it all working
nicely now.  Will credit you all on finished site.

Cheers,

 .ben

> -----Original Message-----
> From: Steve Dix [mailto:[EMAIL PROTECTED]]
> Sent: 16 April 2002 12:26
> To: .ben
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] Faking a form POST
>
>
> 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>==============================<[EMAIL PROTECTED]
> http://www.stevedix.de/
> http://www.snorty.net/
> http://www.mp3.com/simpletons
> http://www.geocities.com/motorcity/2706
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to