On Thu, Oct 01, 2009 at 12:24:41AM -0400, Daniel Brown wrote: > On Thu, Oct 1, 2009 at 00:16, Paul M Foster <pa...@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.
fsockopen() appears to be part of the standard network functions in PHP, like the header() function. Do you mean that many hosts support the function (as part of PHP) but don't support its use with external hosts? Is there a way to determine this support from looking at phpinfo()? Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php