Re: POST without POSTing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 1 Oct 2009 00:16:27 -0400
Paul M Foster <paulf@xxxxxxxxxxxxxxxxx> wrote:

> On Wed, Sep 30, 2009 at 11:36:55PM -0400, Daniel Brown wrote:
> 
> > On Wed, Sep 30, 2009 at 23:29, Paul M Foster
> > <paulf@xxxxxxxxxxxxxxxxx> wrote:
> > >
> > > I'm not sure how to do this. Please no exotic external libraries
> > > my shared hosting provider doesn't include. RTFM will be fine;
> > > just tell me which Fine Manual to Read.
> > 
> >     Nothing too exotic at all, Paul.  Check out cURL:
> > 
> >     http://php.net/curl
> 
> I was afraid you were going to say that, and I wasn't sure cURL was
> supported on that server. But I just loaded phpinfo on that server,
> and it is supported.
> 
> However, assuming it *wasn't*, I've found the following example from a
> google search (thank goodness for google's "hinting" or I couldn't
> have found it):
> 
> $fp = fsockopen("www.site.com", 80);
> fputs($fp, "POST /script.php HTTP/1.0
> Host: www.site.com
> Content-Length: 7
> 
> q=proxy");
> 
> I don't know much about doing things this way. It appears that when
> done this way, the "body" must be separated by a newline, just like
> email. And it appears that the content-length of 7 indicates the
> length of the "q=proxy" string. Assuming I piled on a few other
> passed variables the same way as "q", separated by newlines (and
> adjusted the Content-Length accordingly), would the above work? Are
> there liabilities to doing it this way?
> 
> Paul
> 

Not separated by newlines; separated by ampersands. But otherwise,
that's just raw HTTP 1.1 protocol. cURL and other tools might look a bit
more complicated at first, but (assuming they're available) they do
shield you from the raw protocol a bit. No real liability to doing it
that way other than it's a bit more work.

http://developers.sun.com/mobility/midp/ttips/HTTPPost/


Regards,

Torben

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux