Re: POST without POSTing
| From: | Daniel Brown | Date: | Thu, 01 Oct 2009 04:24:41 +0000 |
| Subject: | Re: POST without POSTing | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298428@lists.php.net to get a copy of this message | ||
On Thu, Oct 1, 2009 at 00:16, Paul M Foster <paulf@quillandmouse.com> wrote:
>
> 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?
Yes. Hosts are more likely to have cURL installed and available
than fsockopen() or URL-based fopen() calls, so portability is greater
with cURL. It's also a bit faster. Still, as you know, there's
always more than one way to skin a cute, furry, delicious little
kitten.
--
</Daniel P. Brown>
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig