Capture poker star free Game Player Rankings

Source: Internet
Author: User
Function getpokerstaropenplayers () {// http://www.intellipoker.tw/leagues/Open-League/leaderboard? Page = 1 // get poker star open player ranking $ url = "http://www.intellipoker.tw/leagues/Open-League/leaderboard"; $ html = file_get_html ($ URL); if ($ html = false) {echo "get false"; exit (0) ;}$ playerrow = $ HTML-> Find ('tr [class = "odd"] '); $ playerdata = array (); If (! File_exists ("D: // pokerfree/paiming1.txt") {foreach ($ playerrow as $ row) {$ paiming = $ row-> Children [1]; $ palyername = $ row-> Children [3]-> Find ("A"); $ score = $ row-> Children [count ($ row-> children) -1]-> Find ("A"); // print_r ($ paiming-> innertext); // print_r ($ palyername [0]-> innertext ); // print_r ($ score [0]-> innertext); $ name = $ palyername [0]-> innertext; $ name = str_replace ("&","&", $ name); $ name = str_replace ("<"," <", $ Name); $ name = str_replace ("> ","> ", $ name); $ name = str_replace ("'","'", $ name); $ name = str_replace ("\" "," ", $ name); file_put_contents (" D: // pokerfree/paiming1.txt ", "<Note player = \"". $ name. "\" label = \ "5 \" update = \ "1404984118 \"> ". $ paiming-> innertext. ",". $ score [0]-> innertext. "</Note> \ n", file_append); // $ playerdata [$ paiming] = array ($ paiming, $ palyername, $ score );}} else {$ DATA = file_get_contents ("D: // P Okerfree/paiming1.txt ");} For ($ I = 1; $ I <= 500; $ I ++) {If (! File_exists ("D: // pokerfree/paiming1_i1_.txt") {$ url = "http://www.intellipoker.tw/leagues/Open-League/leaderboard? Page = ". $ I; $ html = file_get_html ($ URL); if ($ html = false) {continue ;} $ playerrow = $ HTML-> Find ('tr [class = "odd"] '); foreach ($ playerrow as $ row) {If (count ($ row-> children) <6) continue; $ paiming = $ row-> Children [1]; $ palyername = $ row-> Children [3]-> Find (""); $ score = $ row-> Children [count ($ row-> Children)-1]-> Find ("A"); // print_r ($ paiming-> innertext ); // print_r ($ palyername [0]-> innertext); // print_r ($ score [0]-> innertext); // echo "<Note player = \"". $ palyername [0]-> innertext. "\" label = \ "5 \" update = \ "1404984118 \"> ". $ paiming-> innertext. ",". $ score [0]-> innertext. "</Note> \ n"; $ name = $ palyername [0]-> innertext; $ name = str_replace ("&", "&", $ name ); $ name = str_replace ("<", "<", $ name); $ name = str_replace (">", ">", $ name ); $ name = str_replace ("'", "'", $ name); $ name = str_replace ("\" "," ", $ name); file_put_contents (" D: // pokerfree/paiming‑i‑.txt "," <Note player = \"". $ name. "\" label = \ "5 \" update = \ "1404984118 \"> ". $ paiming-> innertext. ",". $ score [0]-> innertext. "</Note> \ n", file_append );}}} // <Note player = "harry_bt2013" label = "5" update = "1404984118"> will play NL2-7 and other big names all in </Note>}

The above Code uses the third-party HTML library simple_html_dom.php

It only captures the ranking of players within 500 pages.

Each page of player ranking data generates a file.

Then, run the copy *. txt> paiming.txt command in batches to merge the poker star custom tagging file.

Because the web page is crawled, some characters must be escaped when an XML file is generated.

It also involves how PHP parses HTML data usage, which is worth recording.

The following is the HTML code of the player ranking line. In this way, you can find the HTML code in PHP.

<Tr class = "odd"> <TD> </TD> <TD> 1 </TD> <TD class = "marked">  & nbsp; </TD>  <a style = "color: black; "href =" # "> [email protected] </a> </TD>  </TD> <TD class =" gap "> </TD> <TD class =" marked "> $150 </TD> <TD class =" gap"> </TD> <TD class = "marked checked20"> $1,500 </TD> <TD class = "checked" Title = "participant in: 87 ">  </TD> <a style =" color: black; "href ="/leagues/Open-leleague/leaderboard? Username = omegit % 40 & amp; user_id = 4296180 "> 2612.10 </a> </TD> </tr>

These labeled data can be used to identify the approximate strength of players on the Internet. Of course it is not comparable to the professional data software. Please forgive me.

  

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.