2008年9月22日 星期一

url, post, Net, http


url_host = 'iwakela.com'
url_path = '/alert/sms'
url_port = 9001
auth_string = "您的手機警示已經到價"
data = "dstaddr=" + cell_number + \
"&message=" + auth_string
headers = { 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8' }
http = Net::HTTP.new(url_host, url_port)
resp, resp_data = http.post(url_path, data, headers)
save_sms_to_record(cell_number, auth_string, resp_data)

沒有留言: