0 like 0 dislike
1 view
in Ruby by Bilge (163k points)
ruby get metodu parametrelerle kullanımı

1 Answer

0 like 0 dislike
by Bilge (163k points)
require 'net/http'
# Parametreleri hazırlıyoruz
params={:Platformid => "1",
        :chncode => "1",
        :user => "user",
        :pw => "pass",
        :from => "from",
        :to => "+90..",
        :text => "hello"}
# Metodu çağırıyoruz
uri = URI.parse("http://www...")
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(uri)
puts response.uri
puts response.body
s=response.body.to_s
if s.start_with? 'ID:'
  puts "Sent"
else
  puts "Not sent"
end
...