Patrick May <patrick / hexane.org> writes: > Lloyd, > > On Sunday, November 7, 2004, at 10:16 PM, Lloyd Zusman wrote: > >> I'm using Net::HTTP to do a POST operation, but the query string I send >> with variable settings seems to be ignored. Can anyone tell me what I >> might be doing wrong? >> >> require "net/http" >> >> Net::HTTP.version_1_2 >> Net::HTTP.start('www.myhost.tld', 80) { >> |http| >> response = http.post('/test/showvars.php', 'foo=bar&ok=quack') >> puts response.body() >> } >> >> When I run this, none of the variables show up as having been set. > > It could either be ruby not sending the get variables, or php ignoring > the get variables. Is this php var being set appropriately: > > $_SERVER['QUERY_STRING'] > > If this is always being set, then this is just a php thing. If this > variable isn't being set, then it's probably net/http. Thank you. As you now know from my follow-up to my own post, I solved the problem by explicitly setting Content-Type to application/x-www-form-urlencoded. This has to do with net/http, because as I mentioned, this occurs in all CGI's and servlets, not just in the php example that I gave here. And no, QUERY_STRING is not being set. This is also true for all CGI's and servlets, not just php programs. Furthermore, when I do the POST via the HTML <form ...> stuff that I showed in my original message, the same php and all other CGI's and servlets see QUERY_STRING being set, and the variables are available. This no doubt causes the Content-Type to be properly set. -- Lloyd Zusman ljz / asfast.com God bless you.