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 | 59057 | ![]() |
공지 | 중국 생활 안전 수칙 [4] | 2013.03.16 | 82911 | ![]() |
6 | 정치인 사관학교, 조지타운 대학교(Georgetown University) | 2023.12.01 | 3729 | ![]() |
5 | 미국 대학의 기여입학제: 입시 공평성과 논란 | 2023.12.04 | 3952 | ![]() |
4 | [무료상담 이벤트 진행중] 2024년 봄 컨설팅펌 입사대비 Class 개강 안내 (4월 13일(토) 개강 예정) | 2024.03.08 | 2061 | ![]() |
3 | 아포스티유 번역 공증 쉽게 처리한 곳 공유합니다 | 2024.04.11 | 1249 | ![]() |
2 | 북경 내 아르바이트 구인 | 2024.05.23 | 319 | ![]() |
1 | [무료상담/엑셀강의 이벤트 진행중] 2024년 여름 컨설팅펌 입사대비 Class 개강 안내 (6월 29일(토) 개강 예정) | 2024.05.24 | 286 | ![]() |
무었인가요??