2014.05.08 23:41
# encoding: utf-8 require 'httparty' module IB class IBAgent include HTTParty base_uri 'www.ilbe.com' format :plain headers 'Referer' => 'http://www.ilbe.com/index.php?mid=index&act=dispMemberSignUpForm' headers 'User-Agent' => 'Input your user-agent here' headers 'X-Requested-With' => 'XMLHttpRequest' headers 'Content-Type' => 'text/plain' def check_id(user_id) xml = xml_id(user_id) options = { :body => xml } data = self.class.post('/index.php', options) data.include?('이미') end def check_email(user_email) xml = xml_email(user_email) options = { :body => xml } data = self.class.post('/index.php', options) data.include?('다른') end private def xml_id(user_id) "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n \ <methodCall>\n<params>\n<name><![CDATA[user_id]]></name>\n \ <value><![CDATA[#{user_id}]]></value>\n<module><![CDATA[member]]></module>\n \ <act><![CDATA[procMemberCheckValue]]></act>\n</params>\n</methodCall>" end def xml_email(user_email) "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n \ <methodCall>\n<params>\n<name><![CDATA[email_address]]></name>\n \ <value><![CDATA[#{user_email}]]></value>\n<module><![CDATA[member]]></module>\n \ <act><![CDATA[procMemberCheckValue]]></act>\n</params>\n</methodCall>" end end def agent; IBAgent.new end # original text: 이미 존재하는 아이디입니다. 다른 아이디를 입력해주세요. def check_id(user_id) agent.check_id(user_id) end # original text: 사용하실 수 없는 메일 주소입니다. 다른 메일 주소를 입력해주세요. def check_email(user_email) agent.check_email(user_email) end module_function :agent, :check_id, :check_email end
사이트 관리자도 아닌데 괜히 오버한것 같다 고멘. |
번호 | 제목 | 날짜 | 조회 수 | 글쓴이 |
---|---|---|---|---|
공지 | 자유게시판 | 2014.09.21 | 64733 | 22대웹관리자_노천명 |
공지 | 중국 생활 안전 수칙 [4] | 2013.03.16 | 90950 | 20대회장_성유리 |
4 | [1마력 1일 1사설] - [서울신문] " SAT 취소까지 부른 ‘부정 한국’ 부끄럽다 " [3] | 2013.05.03 | 7805 | 허진규1마력 |
3 | 2012.11.2 13클럽에서 어쿠스틱 공연합니다~~ [64] | 2012.10.25 | 8583 | 22대웹관리자_노천명 |
2 | [1마력의 1일 1사설] - [한국일보] "근로계약서 안 쓰고 안 지키면 엄벌해야" [2] | 2013.02.12 | 9216 | 허진규1마력 |
» | 이거 영 좋지가 않다. [4] | 2014.05.08 | 18068 | 허진규1마력 |
무었인가요??