2012年7月13日

[转载]利用ruby的Net::HTTP发起http请求并对返回包进行简单的校验

摘要: 一、先上一段代码:#encoding=utf-8 require'net/http'Net::HTTP.start('tuan.qq.com',80){|http| response=http.get('/')#获取返回包所有信息 #response=http.head('/')#仅仅获取返回头信息 head_hash=response.to_hash head_hash.keys.each{|key| pkey.to_s+':'+head_hash[key].to_s } }#encoding = utf-8 r 阅读全文

posted @ 2012-07-13 15:53 张飞_ 阅读(5805) 评论(0) 推荐(0)

导航