From: Alejandro Ramirez Date: 2007-01-10T02:06:02+09:00 Subject: Re: HTTP post to a differnt port + no content type response Thank you Jan and Rodrigo for taking the time to answer! I've tried Rodrigo's version and it worked fine! But i am curious as of the error i get from Jan's version: protected method `set_query' called for # (NoMethodError) I have looked of the set_query Method but there is not much info there. What could be the cause of this? again thanks! Alejandro Rodrigo Bermejo wrote: > Jan Svitok wrote: >> On 1/8/07, Alejandro Ramierz wrote: >>> I'm trying the following: >>> 'smsc'=>'mysmsc', >>> >>> I am thinking that the error is that I am trying to post in the port >>> 13013? >>> >>> Can someone please guide me on how to achieve this? >> >> Hi, >> >> different port should not be a prolem. I think your problem is that >> you are trying to use POST method (HTTP.post_form) while what you >> really want is GET (at least your first example implies that). >> >> So try >> >> #!/usr/bin/ruby >> require 'net/http' >> require 'uri' >> >> uri = URI.parse('http://192.168.10.204:13013/cgi-bin/sendsms') >> uri.set_query( 'user'=>'tester', 'pass'=>'foobar', 'from'=>'444', >> 'to'=>'44440295', 'smsc'=>'mysmsc', 'text'=>'Test from ruby!') >> >> res = Net::HTTP.get(uri), >> puts res.body >> > > Or > > #!/usr/bin/ruby > require 'open-uri' > p > open("http://192.168.10.204:13013/cgi-bin/sendsms?user=tester&pass=foobar&from=444&to=3423424&smsc=mysmsc&text=test > from ruby") > > > -.rb -- Posted via http://www.ruby-forum.com/.