{"id":17936,"date":"2020-02-04T15:03:14","date_gmt":"2020-02-04T07:03:14","guid":{"rendered":"http:\/\/4563.org\/?p=17936"},"modified":"2020-02-04T15:03:14","modified_gmt":"2020-02-04T07:03:14","slug":"%e5%88%86%e4%ba%ab%e4%b8%aajava%e7%89%88hostloc%e7%ad%be%e5%88%b0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=17936","title":{"rendered":"\u5206\u4eab\u4e2aJava\u7248HostLoc\u7b7e\u5230"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>ansheng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u5206\u4eab\u4e2aJava\u7248HostLoc\u7b7e\u5230<\/h3>\n<p>  \t\t\u8feb\u4e8e\u8bba\u575b\u6ca1\u6709Java\u7248\u7684\uff0c\u5c0f\u767d\u64b8\u4e86\u4e00\u4e2a\uff0c\u5206\u4eab\u7ed9\u5927\u5bb6<\/p>\n<p>  import org.jsoup.Connection;<br \/>  import org.jsoup.Jsoup;<\/p>\n<p>  import java.io.IOException;<br \/>  import java.util.Map;<\/p>\n<p>  public class HostLocSignIn {<br \/>  &nbsp; &nbsp; public static void main(String[] args) throws IOException {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;String UserAgent = &quot;Mozilla\/5.0 (Windows NT 6.1; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/50.0.2661.102 Safari\/537.36&quot;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;Map&lt;String, String&gt; cookies = Jsoup.connect(&quot;https:\/\/www.hostloc.com\/member.php?mod=logging&amp;action=login&amp;loginsubmit=yes&amp;infloat=yes&amp;lssubmit=yes&amp;inajax=1&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .method(Connection.Method.POST)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .data(&quot;fastloginfield&quot;, &quot;username&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .data(&quot;quickforward&quot;, &quot;yes&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .data(&quot;handlekey&quot;, &quot;1s&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .data(&quot;username&quot;, &quot;USERNAME&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .data(&quot;password&quot;, &quot;PASSWORD&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .header(&quot;Accept&quot;, &quot;text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .header(&quot;Accept-Encoding&quot;, &quot;gzip, deflate, sdch&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .header(&quot;Accept-Language&quot;, &quot;zh-CN,zh;q=0.8,en;q=0.6&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .header(&quot;Host&quot;, &quot;www.hostloc.com&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .header(&quot;Referer&quot;, &quot;https:\/\/www.hostloc.com\/forum.php&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .header(&quot;Upgrade-Insecure-Requests&quot;, &quot;1&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .userAgent(UserAgent)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .execute()<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .cookies();<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;String currentMoney = Jsoup.connect(&quot;https:\/\/www.hostloc.com\/home.php?mod=spacecp&amp;ac=credit&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .userAgent(UserAgent)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .cookies(cookies)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .get()<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .select(&quot;#extcreditmenu&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .text();<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;for (int i = 20350; i &lt;= 20370; i++) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Jsoup.connect(String.format(&quot;https:\/\/www.hostloc.com\/space-uid-%s.html&quot;, i)).userAgent(UserAgent).cookies(cookies).get();<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;}<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;String newMoney = Jsoup.connect(&quot;https:\/\/www.hostloc.com\/home.php?mod=spacecp&amp;ac=credit&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .userAgent(UserAgent)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .cookies(cookies)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .get()<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .select(&quot;#extcreditmenu&quot;)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; .text();<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;System.out.println(String.format(&quot;%s to %s&quot;, currentMoney, newMoney));<br \/>  &nbsp; &nbsp; }<br \/>  }\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>jeff<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4ee5\u524d\u6709\u4e2ajava\u7248\uff0c\u4f46\u662f\u6ca1php\u65b9\u4fbf \u6ca1\u4eba\u7528\u5c31\u51c9\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u53e4\u85e4\u541b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u9700\u8981\u8fd9\u4e48\u591aheader&#8230;\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>ansheng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u53e4\u85e4\u541b \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-2-4 14:46<br \/>  \u9700\u8981\u8fd9\u4e48\u591aheader&#8230;<\/p>\n<p> \u6211\u4e4b\u524d\u7528Python\u7684\u5199\u4e86\u8fd9\u4e48\u591a\uff0c\u6211\u4e5f\u5c31\u52a0\u4e0a\u53bb\u4e86\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>ansheng \u5927\u4f6c\u6709\u8bdd\u8bf4 : \u5206&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/17936"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17936"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/17936\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17936"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}