Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user_info = file_get_html('http://community.topcoder.com/tc?module=MemberProfile&cr=10574855')->plaintext;
- $user_info = "User Info of the user is: ".$user_info;
- $user_info = trim($user_info);
- $user_info = preg_replace('/\s+/', ' ', $user_info);
- $user_info = mysql_real_escape_string( $user_info);
- //echo $user_info;
- $user_name = "";
- $start_pos1 = strpos ($user_info , "Member Since");
- for($j = $start_pos1-1;$j>0;$j--){
- $st = substr($user_info, $j , 1);
- if(strcmp($st, "%") == 0) break;
- $st = $st.$user_name;
- $user_name = $st;
- }
- $start_pos1 = strpos ($user_info , "Algorithm Competitions Rating") + 30;
- $current_rating = substr($user_info, $start_pos1 , 5);
- echo "<br>Current Rating: ".$current_rating;
- $start_pos1 = strpos ($user_info , "Maximum Rating") + 15;
- $maximum_rating = substr($user_info, $start_pos1 , 5);
- echo "<br>Maximum Rating: ".$maximum_rating;
- $start_pos1 = strpos ($user_info , "Minimum Rating") + 15;
- $minimum_rating = substr($user_info, $start_pos1 , 5);
- echo "<br>Minimum Rating: ".$minimum_rating;
- $start_pos1 = strrpos ($user_info , "Competitions") + 12;
- $Competitions = substr($user_info, $start_pos1 , 4);
- echo "<br>Competitions: ".$Competitions;
- $start_pos1 = strpos ($user_info , "Competition History Percentile") + 31;
- //$last_pos1 = strpos ( $user_info , "Problems Partially Solved");
- //$Len1 = $last_pos1 - $start_pos1;
- $Percentile = substr($user_info, $start_pos1 , 5);
- echo "<br>Current Percentile: ".$Percentile;
- $start_pos1 = strpos ($user_info , "Rank ") + 4;
- $last_pos1 = strpos ( $user_info , "Country Rank");
- $Len1 = $last_pos1 - $start_pos1;
- $Rank = substr($user_info, $start_pos1 , $Len1);
- echo "<br>Current Rank: ".$Rank;
- $div1 = "";$div2 = "";$challenges = "";
- $Len = strlen($user_info);
- $start_pos1 = strrpos ($user_info , "Competitions") + 12;
- $i = 0;
- while($i<$Len){
- $ss = substr($user_info, $i , 5);
- if(strcmp($ss, "Total") == 0){
- for($j = $i+6;$j<$Len;$j++){
- $st = substr($user_info, $j , 1);
- $div1 = $div1.$st;
- if(strcmp($st, "%") == 0) break;
- }
- $i+=5;
- break;
- }
- $i++;
- }
- while($i<$Len){
- $ss = substr($user_info, $i , 5);
- if(strcmp($ss, "Total") == 0){
- for($j = $i+6;$j<$Len;$j++){
- $st = substr($user_info, $j , 1);
- $div2 = $div2.$st;
- if(strcmp($st, "%") == 0) break;
- }
- $i+=5;
- break;
- }
- $i++;
- }
- while($i<$Len){
- $ss = substr($user_info, $i , 5);
- if(strcmp($ss, "Total") == 0){
- for($j = $i+6;$j<$Len;$j++){
- $st = substr($user_info, $j , 1);
- $challenges = $challenges.$st;
- if(strcmp($st, "%") == 0) break;
- }
- $i+=5;
- break;
- }
- $i++;
- }
- $div1_list = explode(' ',$div1);
- $div2_list = explode(' ',$div2);
- $challenges_list = explode(' ',$challenges);
- $div1_solved = $div1_list[0];
- $div1_failed_challenge = $div1_list[1];
- $div1_failed_system_test = $div1_list[2];
- $div1_success = $div1_list[3];
- $div2_solved = $div2_list[0];
- $div2_failed_challenge = $div2_list[1];
- $div2_failed_system_test = $div2_list[2];
- $div2_success = $div2_list[3];
- $failed_challenge = $challenges_list[0];
- $total_challenge = $challenges_list[1];
- $challenges_success = $challenges_list[2];
- echo "<br>div1 submission: ".$div1_solved;
- echo "<br>div1 failed challenge: ".$div1_failed_challenge;
- echo "<br>div1 failed system_test: ".$div1_failed_system_test;
- echo "<br>div1 success: ".$div1_success;
- echo "<br>div2 submission: ".$div2_solved;
- echo "<br>div2 failed challenge: ".$div2_failed_challenge;
- echo "<br>div2 failed system test: ".$div2_failed_system_test;
- echo "<br>div2 success: ".$div2_success;
- echo "<br>total challenge: ".$total_challenge;
- echo "<br>failed challenge: ".$failed_challenge;
- echo "<br>challenges success: ".$challenges_success;
- echo "<br>user name: ".$user_name;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment