Created
November 17, 2016 12:58
-
-
Save lajunta/5c8db8d4a6e6c9da25dd2b880f25925f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "restclient" | |
require "json" | |
#@keyword = URI::decode("新闻快讯") | |
@keyword = "学校公告" | |
start = '0' | |
lmt = '10' | |
@kword = @keyword.encode("GB2312","UTF-8") | |
kword = URI::encode(@kword) | |
lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/active_app/login1.php" | |
user = "login_user_m_=ftuo" | |
psd = "login_password=fengtuo" | |
res = RestClient.post(lurl,{login_user_m_: "xxx",login_password: "xxx"}) | |
cook = res.cookies | |
puts cook | |
aurl = "http://www.lwqzx.sdedu.net/kernel/net_school/islogin.php" | |
ares = RestClient.get(aurl,{cookies: cook}) | |
puts ares.to_s | |
murl = 'http://www.lwqzx.sdedu.net/m/net_school/docs/api.php?op=list_json&kword='+kword+'&start='+start+'&lmt='+lmt+'&width=42' | |
infos1 = RestClient.get(murl,{cookies: cook}).body | |
content1=infos1.encode("UTF-8","GB2312") | |
puts JSON.parse(content1).second | |
# %x[rm /tmp/cookies] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment