L
Lauren
I have a simple server and client application. Client side uses
HTTP::request_get to contact server file "sum.rb", which takes
parameter a and b, return the sum a+b. Client side code is as:
url = "http://"+MYURL+"/sum.rb"
uri = URI.parse(url)
content = "?a=3&b=5"
http = Net::HTTP.start(uri.host, uri.port)
response = http.request_get(uri.path + content)
puts response.inspect
if (response.code[0,1] == "2" && response.body != "0")
puts response.body
end
Question: (maybe I used php too much)
1. How sever side parse the parameter a and b (in php, we can use
a=_GET['a']; b= _GET['b'] to retrieve content
2. How server side response to client (in php, we can use echo a+b?
But It seems that my response.body is always the sum.rb code instead
of the actual sum.
HTTP::request_get to contact server file "sum.rb", which takes
parameter a and b, return the sum a+b. Client side code is as:
url = "http://"+MYURL+"/sum.rb"
uri = URI.parse(url)
content = "?a=3&b=5"
http = Net::HTTP.start(uri.host, uri.port)
response = http.request_get(uri.path + content)
puts response.inspect
if (response.code[0,1] == "2" && response.body != "0")
puts response.body
end
Question: (maybe I used php too much)
1. How sever side parse the parameter a and b (in php, we can use
a=_GET['a']; b= _GET['b'] to retrieve content
2. How server side response to client (in php, we can use echo a+b?
But It seems that my response.body is always the sum.rb code instead
of the actual sum.